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

Free Support Forum - aspose.com

PDF Fonts


I'm just giving Apose.PDF for Java a try on Mac OS 10.6.

Unfortunately, I cannot get the pdf to show the correct fonts.

Is there any error in the following code?

Pdf pdf = new Pdf();

Section sec1 = pdf.getSections().add();

Text text1 = new Text(sec1);

Segment s1 = new Segment(text1);
s1.setContent("Hello world!\n");

Segment s2 = new Segment(text1);
s2.setContent("Hello world!\n");

Segment s3 = new Segment(text1);
s3.setContent("Hello world!\n");


The resulting pdf looks like this:


Thanks for your help!

Best regards,
This message was posted using Page2Forum from Use PDF Core Fonts - Aspose.Pdf for Java

Hello Juergen,

Thanks for using our products.

Can you please confirm which version of Aspose.Pdf for Java and JDK you are using ?

We apologize for your inconvenience.

PS, During my test with JDK 1.6.0_20 over Windows XPSP3 while using Aspose.Pdf for Java 2.7.0, I am unable to notice any problem. However, we need to check this problem over MAC OS

Hi codewarrior!

Thanks for the quick reply.

I reproduced the problem on a windows box. The aspose pdf version 2.7.0 for jdk 1.6.

On Mac OS X I'm running Java(TM) SE Runtime Environment (build 1.6.0_20-b02-279-10M3065)
Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01-279, mixed mode).

On Windows I#m running Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

B.t.w. the samples included with 2.7.0 do not work due to a change in the names of your packages.

Best regards, Juergen

Hello Juergen,

Thanks for the information.

I have again tested the scenario in Java console application over Windows XP SP2 with JDK 1.6.0_20 where Aspose.Pdf for Java version is 2.7.0 and as per my observations, the fonts information is properly being included in the resultant PDF documents. Please make sure that the specific fonts are installed over the system over which you are generating the PDF documents.

Nevertheless, I will try my level best to test the scenario over Java HotSpot client VM's and will share my findings within this forum thread.

We apologize for your inconvenience.

Hello Juergen,

Thanks for your patience.

I have tested the scneario in details over Windows XP and MAC OSX and I am able to notice the problem. For the sake of correction, I have logged it in our issue tracking system as PDFJAVA-20458. We will investigate this issue in details and will keep you updated on the status of a correction. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

We apologize for your inconvenience.

Hello Nayyer!

Is there any news on this issue?



Hello Juergen,

Thanks for your patience and sorry for replying you so late.

In fact I have been in coordination with the development team to get the ETA regarding the resolution of this problem. As per our current estimates, we expect to have this issue resolved by the month of November but still it's not a promise. We will try our level best to get it resolve ASAP and as soon as its hotfix becomes available, we would be pleased to update you with the status of correction.

Your greatly admire your patience and comprehension in this regard. We apologize for your inconvenience.

Hello codewarrior!

Is there any workaround to set the font type?

If it is based on the jvm, which combination of plattform and jvm does work?

I need to get a proof of concept ready until the beginning of december. Can you give me an update wether the issue will be solved in the next 2 weeks? If I don’t have a chance to use aspose pdf correctly I need to change to iText. That would be really bad because a sister project just bought a license for your word file format solution and I skipped the evaluation of iText because of the great experience with your word solution.

Best regards, Juergen


Are there any news in the subject?

Setting fonts should be a core functionality that is covered by the quality assurance.

This and the StackOverflowError I described in a different thread does not shed the best of light on aspose.pdf.

Thanks for keeping me informed.

Best regards, Juergen

Hi Juergen,

I have contacted our team for the ETA of this issue and I would like to share with you
that the fix for this issue will be available in our February 2011
release, which will be published at the end of the February 2011 or
early March 2011. You’ll be notified via this forum thread once the
release is published.

If you find any further questions, please do let us know.


Hi Juergen,

Thanks for your patience and sorry for such a long delay.

We have further investigated this problem and have found that the problem is in default true value for aspose.pdf.TextInfo.isUnicode variable. We have this changes in code since 2010-02-03. We have discussed this matter and have decided to stick with the current value as true. Furthermore, we have such requirements for using Unicode in our docs:
When using unicode, you must specify the Font file name. After specifying the Font file name, font name is no longer needed. TextInfo.setIsUnicode() method is used for this purpose.

So bug will be fixed in one of the following ways:
  1. text.getTextInfo().setIsUnicode(false);
  2. either(for the case user wants to use Unicode):text.getTextInfo().setTruetypeFontFileName("…/fonts/truetype/msttcorefonts/Courier_New.ttf"); .
  3. OR using option 1 in conjunction with 2.

We have checked the above described approach with latest release versions of Aspose.Pdf for Java and it seems to work without any issue. Please try using our product and in case you still face the same problem or you have any further query, please feel free to contact. We are really sorry for this delay and inconvenience.