Bug 60914

Summary: DOC TO PDF
Product: POI Reporter: pooja.dhannawat535
Component: HWPFAssignee: POI Developers List <dev>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P2    
Version: 3.15-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

Description pooja.dhannawat535 2017-03-24 11:17:04 UTC
Is there any way to convert .doc to .pdf.
I tried using fo also but in that case I got issues with images in output pdf.
Images were coming in output .fo file as I have overridden the method as follows -

public class CustomImageWordToFoConverter extends WordToFoConverter {
    public CustomImageWordToFoConverter(Document document) {
        super(document);
    }
    @Override
    protected void processImageWithoutPicturesManager(Element currentBlock,
                                                      boolean inlined, Picture picture)
    {
        Element imgNode = currentBlock.getOwnerDocument().createElement("img");
        StringBuilder sb = new StringBuilder();
       sb.append(Base64.getMimeEncoder().encodeToString(picture.getRawContent()));
        sb.insert(0, "data:"+picture.getMimeType()+";base64,");
        imgNode.setAttribute("src", sb.toString());
        currentBlock.appendChild(imgNode);
    }
} 

Please suggest best way to convert .doc to .pdf with all formatting and images retained in outout
Comment 1 Tim Allison 2017-03-24 11:26:12 UTC
Please ask these types of questions on our users list: user@poi.apache.org.  The issue tracker is for reporting problems or requesting new features.