I have tried implementing IWarningCallback | Aspose.Words for Java but still i don’t see any warnings for font substitution.
As in output file I can see Arial font is being substituted but warning is not coming up on console.
I have tried installing Fanwood font also but still the output is not as expected.
Output file shared below : output.pdf (101.7 KB)
@rnara It looks like misunderstood me. I mean that in the PDF you have attached Fanwood font is used instead the font specified in your source document. This occurs when there are no font available in the environment where document is converted to PDF. Aspose.Words uses Fanwood font as the last resort font.
Please try using the following code to check for warnings:
Document doc = new Document("C:\\Temp\\in.docx");
doc.setWarningCallback(new FontSubstitutionWarningCollector());
doc.save("C:\\Temp\\out.pdf");
private static class FontSubstitutionWarningCollector implements IWarningCallback {
public void warning(WarningInfo info) {
if (info.getWarningType() == WarningType.FONT_SUBSTITUTION) {
System.out.println(info.getDescription());
}
}
}
@rnara Enabling Open Type Feature does not affect font substitution. Here is the PDF document produced on my side: out.pdf (64.5 KB)
As I can see it looks the same as PDF produced by MS Word.
// Open a document
Document doc = new Document("in.docx");
// When text shaper factory is set, layout starts to use OpenType features.
// An Instance property returns static BasicTextShaperCache object wrapping HarfBuzzTextShaperFactory
doc.getLayoutOptions().setTextShaperFactory(com.aspose.words.shaping.harfbuzz.HarfBuzzTextShaperFactory.getInstance());
// Render the document to PDF format
doc.save("out.pdf");
Hi @alexey.noskov ,
I tried reproducing and now I don’t see any Calibri or other fonts expect arabic.
But the signature part is still not aligned as shown in image below
I have attached both out.pdf and out.xps files below. files.zip (149.6 KB)
Hi @alexey.noskov ,
As we have tried all possibilities suggested but none of them worked.
Can you please provide any solution on how we can move ahead or fix this issue?
Thanks,
Krishna
@rnara Unfortunately, There are no other recommendations then provided above. To sum them up to get the correct rendering on my side I made the following actions:
Used the following code and the latest version of Aspose.Words for Java:
// Open a document
Document doc = new Document("in.docx");
// When text shaper factory is set, layout starts to use OpenType features.
// An Instance property returns static BasicTextShaperCache object wrapping HarfBuzzTextShaperFactory
doc.getLayoutOptions().setTextShaperFactory(com.aspose.words.shaping.harfbuzz.HarfBuzzTextShaperFactory.getInstance());
// Render the document to PDF format
doc.save("out.pdf");
Hi @alexey.noskov ,
I am also having same locale but still not getting expected output file.
I have tried everything suggested but nothing worked.
Any way we can progress on this?
@rnara Thank you for additional information. Unfortunately, the problem is still not reproducible on my side.
MS Word: out.pdf (61.1 KB)
Aspose.Words for Java 25.3: out_java.pdf (64.5 KB)
You are using 25.1 version of Aspose.Words. But even with this version the output is correct on my side:
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.