Empty fields when converting PDF to DOC

Hello,
I have an issue when converting PDF with filled forms to DOC.
The process works OK on one machine (Linux Mint with GUI), Word version is visually identical to PDF (forms are generated as images).
However the same code produces empty forms on other server (headless CentOS 6).


There is not much in the code to show:

// Open the source PDF document
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(filePdf.getAbsolutePath());
// Save the file into Microsoft document format
pdfDocument.save(fileDoc.getAbsolutePath(),com.aspose.pdf.SaveFormat.Doc);



Here are the OS details:
Working version:
Linux Mint
java version "1.7.0_79"
OpenJDK Runtime Environment (IcedTea 2.5.6) (7u79-2.5.6-0ubuntu1.14.04.1)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)


Not working version:
CentOS 6 (headless server)
java version "1.7.0_71"
OpenJDK Runtime Environment (rhel-2.5.3.1.el6-x86_64 u71-b14)


I don’t have the example PDF ready yet, but if there is some known issue with available solution I will be happy to use it.

Thank you!

Hi Vadim,


Thanks for your interest in Aspose. Apparently it seems the fonts related issue, Aspose.Pdf for Java Jar is not finding proper fonts on your CentOS server.

Please note most of the PDF documents that we convert are created by people using Windows or Mac OS operating systems with fonts that are installed with Microsoft Windows or with Microsoft Office. So it is recommended to either install Microsoft fonts (mscorefonts) or copy true type fonts from your windows/Mac machine to your Linux server system default font folder path and try the conversion. Hopefully it will resolve the issue. However it the issue persist then please share your input output documents here, we will look into it and guide you accordingly.

Furthermore if you want to use fonts form some of your custom folder then you need to add that folder path into LocalFontPath as following. You can use following methods to get system folder of fonts or set font path to font folders.

  • Document.getLocalFontPath () - shows the system folder in which project will look for fonts.
  • Document.setLocalFontPath (String) - Setting font path to custom folder

// Set font folder path<o:p></o:p>

String path = “/home/tilal/fonts/”;<o:p></o:p>

// Adding a single font directory<o:p></o:p>

// com.aspose.pdf.Document.addLocalFontPath(path);<o:p></o:p>

// setting the user list for standard font directories<o:p></o:p>

java.util.List list = com.aspose.pdf.Document.getLocalFontPaths();<o:p></o:p>

list.add(path);<o:p></o:p>

com.aspose.pdf.Document.setLocalFontPaths(list);

…<o:p></o:p>


We are sorry for the inconvenience caused.

Best Regards,

Thank you for detailed suggestion,
it seems reasonable that the fonts are the issue here. As for now we took different approach to generate doc files. In case we need to perform conversion again, we’ll test this solution.

Vadim

Hi Vadim,


Aspose.Pdf for Java also offers the feature to replace fonts in existing PDF document, so you can replace the fonts inside PDF file with fonts already installed on your system. For more information, you may consider visiting Replace fonts in existing PDF file