We recently upgraded aspose from version 19.3 to version 22.9 on our Windows server. Hebrew characters now don’t render at all when converting txt to pdf, showing up as the character often seen in place of unicode characters that fail to load. We have a large number of Fonts installed on the servers, including david.tff and frank.tff.
The relavent code in our service is:
PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.setSaveFormat(SaveFormat.PDF);
saveOptions.setJpegQuality(75);
saveOptions.setTextCompression(PdfTextCompression.FLATE);
baos = new ByteArrayOutputStream();
doc.save(baos, saveOptions);
return baos.toByteArray();
@ysaadi It seems that there are no required font available to Aspose.Words on your server. Particularly Aspose.Words tries to use “Times New Roman” font for the Hebrew text. Please check Specify TrueType Fonts Location article. You could check the fonts availability by GetAvailableFonts method or you could use warnings to check that font substitution appeared. If you do not have access to Windows/Office fonts, you could use Google Noto fonts as an free alternative.
There are two sources of fonts. One loaded from windows machine and one bundled with our service. Both were priority 0.
PhysicalFontInfo FontFamily: Times New Roman, FullName: Times New Roman Bold Italic, FilePath: D:\platform\template\template_test860\WEB-INF\classes\conf\fonts\Times New Roman Bold Italic.ttf, Version: Version 5.00.3x
PhysicalFontInfo FontFamily: Times New Roman, FullName: Times New Roman Bold, FilePath: D:\platform\template\template_test860\WEB-INF\classes\conf\fonts\Times New Roman Bold.ttf, Version: Version 5.01.3x
PhysicalFontInfo FontFamily: Times New Roman, FullName: Times New Roman Italic, FilePath: D:\platform\template\template_test860\WEB-INF\classes\conf\fonts\Times New Roman Italic.ttf, Version: Version 5.00.3x
PhysicalFontInfo FontFamily: Times New Roman, FullName: Times New Roman, FilePath: D:\platform\template\template_test860\WEB-INF\classes\conf\fonts\Times New Roman.ttf, Version: Version 5.01.3x
PhysicalFontInfo FontFamily: Times New Roman, FullName: Times New Roman, FilePath: C:\Windows\Fonts\times.ttf, Version: Version 6.96
PhysicalFontInfo FontFamily: Times New Roman, FullName: Times New Roman Bold, FilePath: C:\Windows\Fonts\timesbd.ttf, Version: Version 6.96
PhysicalFontInfo FontFamily: Times New Roman, FullName: Times New Roman Bold Italic, FilePath: C:\Windows\Fonts\timesbi.ttf, Version: Version 6.96
PhysicalFontInfo FontFamily: Times New Roman, FullName: Times New Roman Italic, FilePath: C:\Windows\Fonts\timesi.ttf, Version: Version 6.96
here are the times related tffs: times_tffs.zip (2.1 MB)
I can get you the whole output for the loaded fonts and a zip file of all the fonts on our windows machine + what we package with our service. I notice that what we package with is a bit outdated, not sure if that can cause anything.
@ysaadi You have attached the “Times New Roman” fonts version 6.96 from the system. Could you please also attach the “Times New Roman” fonts version 5.0… bundled with your service?
@ysaadi Unfortunately I still cannot reproduce the problem on my side. The provided “Times New Roman” fonts are properly used by Aspose.Words for the Hebrew text (see test.awjava.22.12.pdf (19.2 KB)).
Could you please create a small test project which will use a single FolderFontSource and a minimum set of fonts so the problem will be reproduced on your side?
Aspose is used for a fairly large number of documents of diverse type. Disabling a large chunk of our fonts can have unintended/unforeseeable consequences. Is there any way to pinpoint which exact font was used for a document conversion? I can provide you with the full set of fonts that we load from both font sources, but I would need a way to give it to you since the zip is over the 50 mb limit for upload here.
Meanwhile, I’ll try to test removing some fonts that seem related to hebrew to see if that can be the cause of the issue. I’m also relatively certain that this has happened before with a much smaller aspose library version upgrade. I’ll test that this morning, so we can maybe just look at patch notes and guess what could be causing this. Here’s one candidate: Aspose.Words for .NET 19.4 Release Notes
@ysaadi Thanks for sharing the details. Unfortunately we cannot proceed with the issue until we will be able to reproduce it in test environment. You could upload the fonts pack onto some file hosting service like dropbox or google docs and provide a link here.
@ysaadi Unfortunately I still cannot reproduce the problem on my side. Could you please share a test solution which reproduces the problem on your side? May be you use some non-default font settings which leads to the issue. It may be SubstitutionSettings.TableSubstitution if you assumption about 19.4 fix is correct.
We don’t touch substitutionSettings. We get the default instance and just add a font source. I can follow up with a small project that replicates this. Also, I tried to use a much smaller set of fonts that included times new roman, and the issue still reoccurred.
I can create something small and send it to you. Also, would you guys be willing to have a short meeting to discuss? The conversation here is fairly productive, but maybe having freeform discussion might be helpful at this point. the possible range of meetings where my teammates can join is about 8 am EST to 6pm EST. As an individual, I can meet at earlier times (from about 4am EST).
I’ll also check with my manager etc if I can share the full Pdf Conversion class with you. Maybe I can email it to someone? That may be helpful as well.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.