Boxes Instead of Characters in PDF Rendered by Java aspose.words 10.0.0

Hi,

I have a test program that replaces strings in a Word document and then saves the file in a PDF. The essential part of my code is here:

final String IN_FILE = IN_FILE2;
final String OUT_FILE = OUT_FILE2;

Document doc = new Document(IN_DIR + IN_FILE);

doc.getRange().replace(KEY1, SUB1, true, false);
doc.getRange().replace(KEY2, SUB2, true, false);

final File fontPathFile = new File ("/System/Library/Fonts");
System.out.println(“Font path: " + fontPathFile.getPath());

for (File file: fontPathFile.listFiles()) {
System.out.println(file.toString());
}

FontSettings.setFontsFolder(”/System/Library/Fonts");

doc.save(OUT_DIR + OUT_FILE);

I have attached the Word file that is the source, and the resulting PDF file.

I have verified that the replacement occurs correctly, so the PDF rendering is the step that seems to fail. I suspect that it has to do with the fonts.

I explicitly set the font path in the test code like this:

FontSettings.setFontsFolder("/System/Library/Fonts");

What are the required sets of fonts in order to the conversion to work properly?

I’m developing on a MacBook Pro, and the fonts in System/Library/Fonts are as follows:

Apple Braille Outline 6 Dot.ttf
Apple Braille Outline 8 Dot.ttf
Apple Braille Pinpoint 6 Dot.ttf
Apple Braille Pinpoint 8 Dot.ttf
Apple Braille.ttf
Apple Symbols.ttf
AppleGothic.ttf
AquaKana.ttc
Courier.dfont
Geeza Pro Bold.ttf
Geeza Pro.ttf
Geneva.dfont
HelveLTMM
Helvetica LT MM
Helvetica.dfont
HelveticaLight.ttf
HelveticaLightItalic.ttf
HelveticaNeue.dfont
Keyboard.ttf
LastResort.ttf
LucidaGrande.ttc
Menlo.ttc
Monaco.dfont
STHeiti Light.ttc
Symbol.ttf
Thonburi.ttf
ThonburiBold.ttf
Times LT MM
Times.dfont
TimesLTMM
ZapfDingbats.ttf
encodings.dir
fonts.dir
fonts.list
fonts.scale
儷黑 Pro.ttf
华文细黑.ttf
华文黑体.ttf
ヒラギノ明朝 ProN W3.otf
ヒラギノ明朝 ProN W6.otf
ヒラギノ角ゴ ProN W3.otf
ヒラギノ角ゴ ProN W6.otf

Regards,

Martin

Hello,

Thank you for your request.
Unfortunately I was unable to reproduce your problem.
Please try to copy the font that I have attached. This is likely to solve the problem.

Adding the fonts to my font directory has fixed the problem. I now get a well-formed PDF as a result of the conversion.

Thank you for your help.

Martin