Free Support Forum -

PDF to PDF/A-1b conversion issue

Dear All,

While converting a PDF to a PDF/A-1b with Aspose.Pdf, we run into an issue. The code is trying to embed fonts as per Aspose DEV guide,

but fails to do so. The server log indicates that the code trying to embed the fonts does run and does not throw any exception.

The code runs on JBoss 7.1 application server residing on Red Hat Linux 6.x with Java 1.7.

Please advise how to ensure that the listed fonts are successfully embedded into the generated PDF/A. Where does Aspose look for these fonts?

Additionally, there is a non-blocking error reported in the conversion log.
The instanceID field shall not be specified

Please also advise how to overcome that error.

Many thanks!

Java code, conversion log, and original PDF attached.

Hi Dmitri,

Thanks for contacting support.

During the font replace operation, the API finds the fonts in system default directory or you can also specify the directory where fonts are placed/installed. We are working on testing the scenario on Linux environment as currently the API is working fine on Windows platform. We will keep you updated with our findings.

Hi Nayyer,

Thanks for initial feedback. We tried to solve the issue by placing the font files that appear to be missing in the fonts folder of the JRE in which JBoss runs, that is,
…/java64/1.7.0_17/jre/lib/fonts, but this does not seem to have any effect - the error persists.

You mentioned that it is possible to explicitly specify the folder where Aspose will look for the fonts. Could you please share a code snipped that would show how to do that?


Hi Dmitry,

Thank you for the inquiry. Please try the following code to specify the font directory:

String fontFolderPath = “C:\temp\”;
FolderFontSource fs = new FolderFontSource(fontFolderPath);
TextFragment textFragment = new TextFragment(“main text”);
textFragment.setPosition(new Position(100, 600));
textFragment.getTextState().setFont(FontRepository.findFont(“Arial Narrow”));
TextFragment textFragment2 = new TextFragment(“additional text”);
textFragment.setPosition(new Position(100, 400));

Hi Dmitry,

Thanks for contacting support.

Adding more to Imran’s comments, the information/steps shared are related to setting font when manipulating text inside existing PDF document. However when performing PDF to PDF/A conversion on non-Windows platform, the API searches fonts which need to be embedded in PDFA file and in current circumstances, it seems Aspose.Pdf for Java is unable to find fonts on your system. Please note on non-Windows OS, Aspose.Pdf for Java looks fonts in system default font path or specified local font path for custom font directory.

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. To resolve your issue either you can install Microsoft fonts on your system or copy fonts from your windows OS and paste to your system default font path.

Furthermore, if you want to use custom fonts from other than system default font path 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>




We are sorry for the inconvenience caused.