We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Unable to run on Unix

I was able to generate a PDF on Windows, but when I try it on a Unix machine, I get the following error:

Exception in thread “main” java.lang.AssertionError: Cannot read a name from the name table in a font.
at com.aspose.pdf.internal.p242.z1.m1(Unknown Source)
at com.aspose.pdf.internal.p189.z28.m2(Unknown Source)
at com.aspose.pdf.internal.p189.z28.m6(Unknown Source)
at com.aspose.pdf.internal.p189.z28.m1(Unknown Source)
at com.aspose.pdf.internal.p189.z11.m1(Unknown Source)
at com.aspose.pdf.internal.p189.z11.(Unknown Source)
at com.aspose.pdf.internal.p189.z8.m8(Unknown Source)
at com.aspose.pdf.internal.p189.z8.m6(Unknown Source)
at com.aspose.pdf.internal.p189.z8.m1(Unknown Source)
at com.aspose.pdf.internal.p189.z10.m1(Unknown Source)
at com.aspose.pdf.internal.p189.z10.m1(Unknown Source)
at com.aspose.pdf.internal.p189.z10.m1(Unknown Source)
at com.aspose.pdf.internal.p414.z13.m2(Unknown Source)
at com.aspose.pcl.composer.PDFComposer.(Unknown Source)
at aspose.pdf.Pdf.bindPCL(Unknown Source)
at com.aspose.pdf.ADocument.m1(Unknown Source)
at com.aspose.pdf.ADocument.(Unknown Source)
at com.aspose.pdf.Document.(Unknown Source)
at pcltopdf.Converter.generatePdf(Converter.java:123)
at pcltopdf.Converter.main(Converter.java:74)

I looked for other questions with same problem most of them say I need to provide font for Unix, I added a TrueType font and PostScript font next to my jar file, and added the following line to my existing code

Document.addLocalFontPath(path); // path contains location of my jar file and fonts

Any help regarding my issue would be appreciated.

–Edit: Here is the complete code

* Generates PDF file from the PCL and properties file and saves it in the directory found in the properties.
* @param pclFilePath canonical path of PCL file.
* @param properties contains parameters such as output directory, image path, etc…
* @return generated PDF file.
private static Pdf generatePdf(String pclFilePath, Properties properties) throws IllegalArgumentException {
if(pclFilePath == null || pclFilePath.equals("")) {
throw new IllegalArgumentException(“PCL file path is empty.”);
if(properties == null || properties.isEmpty()) {
throw new IllegalArgumentException(“Properties object is empty.”);

String path = “/usr/openwin/lib/X11/fonts/TrueType”;
List paths = new ArrayList();
System.out.println(“font path start”);
for (int i=0; i<Document.getLocalFontPaths().size(); i++){
System.out.println(“font path end”);

// Printing the font path the Document class has stored.
System.out.println(“Font Path from Document:”);
for(int i = 0; i < Document.getLocalFontPaths().size(); i++) {
System.out.println(“Finished printing Font Path”);
Document doc = new Document(pclFilePath, new PclLoadOptions());
return doc;

— Hello Again, below some advanced testing:
//Create PDF document
Pdf pdf1 = new Pdf();
//Add a section into the PDF document
Section sec1 = pdf1.getSections().add();
//Add a text paragraph into the section
Text text1 = new Text(“hello World - Arial”);
sec1.getParagraphs().add(text1 );
//Save the document

the above code is causing exception:
INFO: Error - Font ‘Arial’ not found. Please make sure the customer font file is correctly set.

NOTE: i need to solve the initial first problem, the last comment about font “Arial” not found is just a remark that i came though when testing

NOTE #2: I am having this issue on Solaris 10

Hello, is it possible a quick reply to this issue as I need to know today to decide if we’ll be buying the license or not.

Hi there,

Thanks for your inquiry. I have tested your source code and PCL file to test the scenario over Ubutu Server 13.10 and Aspose.Pdf for Java 9.7.0 as following. But I am afraid I am unable to notice the issue. So we have logged an investigation ticket PDFNEWJAVA-34638 in our issue tracking system for further investigation and will keep you updated about the issue resolution.

// Set font folder path
String path = “/usr/share/fonts/truetype/msttcorefonts/”;
// seting the user list for standard font directories
java.util.List list = com.aspose.pdf.Document.getLocalFontPaths();

Document doc = new Document(“testpcl_elio.pcl”, new PclLoadOptions());

We are sorry for the inconvenience caused.

Best Regards,


I’ve tried it also on Ubuntu it worked fine, but the problem was when trying it on Solaris 10.


Hi there,

Thanks for your feedback. We have already logged above investigation ticket to verify Solaris 10 font settings. We will let you know our findings as soon as we complete the investigation.

Meanwhile, can you please double check whether you are setting font folder path correctly to your system font folder. Moreover please note API looks fonts file in root folder not in sub folders.

String path = “/usr/openwin/lib/X11/fonts/TrueType/”;
String path1="/usr/share/fonts/";
// Set font folder path
// seting the user list for standard font directories
java.util.List list = com.aspose.pdf.Document.getLocalFontPaths();
Document doc = new Document(“testpcl_elio.pcl”, new PclLoadOptions());

We are sorry for the inconvenience caused.

Best Regards,

Has there been any update in the issue?

It seems that Rockwell font is what is causing the error, after removing them I get a new error, an IllegalStateException that the font “Times New Roman” is not found.

Hi Khaled,

Thanks for your patience.

As the issue is recently reported, it’s still open for investigation and I am afraid its not yet resolved. However I have shared your observations with development team and they will definitely consider this information during the resolution of this problem.

As soon as we have some definite news regarding its resolution, we will let you know.

This issue has been open for two months, with no update. Is there any update?

Hi Eric,

Thanks for your inquiry. We have tested the scenario with latest version of Aspose.Pdf for Java 10.0.0. Please download, try latest version of Aspose.Pdf for Java and share the results. Hopefully it will resolve the issue.

Best Regards,

The error “AssertionError: Cannot read a name from the name table in a font” seems to be resolved with version 10.

Hi Eric,

Thanks for sharing the feedback.

We are glad to hear that your problem is resolved. Please continue using our API and in the event of any further query, please feel free to contact.

The issues you have found earlier (filed as PDFNEWJAVA-34638) have been fixed in Aspose.Pdf for Java 11.3.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.