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

Free Support Forum - aspose.com

Specified font is ignored

Hallo

I am using aspose.pdf in order to write some text in a document.
The problem that I encounter is that the specified font is sometimes ignored. This seems to be related to the content of the text.
The code below demonstrates the problem where the specified font is not used, resulting in the attachment named “Result1.pdf”. Note the commented text. When using the commented text instead, the specified font is used correctly, resulting in the attachment named “Result2.pdf”.

LicenseLoader licenseLoader = LicenseLoader.getInstance();
licenseLoader.loadLicenseForAsposePdf();

List inputStringList = new ArrayList<>();
inputStringList.add("†!§$%&/()=ÜPÄÖ*Y>@XCQE ぢゅ竤 基槜け 槜け 䧜坣ぼゔ䤣 ウゥキュ榣な坩, ぢゅ竤 äöüß é ç Здравствуйте 3 df a dad a END");//ぢゅ竤 基槜け 槜け

com.aspose.pdf.Document doc = new com.aspose.pdf.Document(“Blank.pdf”);
com.aspose.pdf.Table table = new com.aspose.pdf.Table();
table.getDefaultCellTextState().setFont(com.aspose.pdf.FontRepository.findFont(“Arial Unicode MS”));
table.setColumnWidths(“400”);

for (String currentString : inputStringList) {
Row row = table.getRows().add();
row.getCells().add(currentString);
}

doc.getPages().get_Item(1).getParagraphs().add(table);
doc.save(“Result1.pdf”);

The only difference is the input text, and the result is different font usage, although font is explicitly set.
I am using aspose.pdf version 17.2.0
This looks like a bug… Is there a workaround for this issue, or anything I can do to correct the behavior?

Thank you,
Samuel

Hi Samuel,


Thanks for contacting support.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial; -webkit-text-stroke: #000000} span.s1 {font-kerning: none}

I have tested the scenario and have managed to reproduce the problem that the input string shared within this forum thread is ignoring the Arial Unicode MS font. For the sake of correction, I have logged it as PDFJAVA-36541 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time.


We are sorry for this inconvenience.


Best Regards,