Conversion from DOCX to PDF creates multiple pages

Hi there,
I have been using Aspose.Words.dll for converting the DOCX to PDF. The source DOCX document has only one page but after conversion to PDF the number of pages are three. See the image below.
image-20220630-105452.png (120.8 KB)

The source document is attached.
Final Employment Approval.docx (63.7 KB)

I am using aspose.words.dll (version 22.3.0.0).

Thanks.

@Wahaj_Khan I cannot reproduce the problem on my side using the latest 22.6 version of Aspose.Words. Also, to get more accurate result you should enable open type features:

Document doc = new Document("C:\\Temp\\in.docx");
doc.LayoutOptions.TextShaperFactory = Aspose.Words.Shaping.HarfBuzz.HarfBuzzTextShaperFactory.Instance;
doc.Save(@"C:\Temp\out.pdf");

Here is output PDF document produced by this code: out.pdf (110.5 KB)

@alexey.noskov thanks for the update. I will try at my end.
Thanks.

1 Like

@alexey.noskov
I have tested in my local environment and it worked without any change but it didn’t work on windows server.
When I investigated further, I found there are few Arabic fonts missing on Windows Server. Could this be the issue?

Also the open type code provided by you gives a compile time error. I have upgraded aspose.words to the latest but I couldn’t find reference of Shaping.HarfBuzz file.
Following is the image.
image.png (52.7 KB)

Thanks.

@Wahaj_Khan Yes, the missed fonts might be the problem. If Aspose.Words cannot find the fonts used in the source document, the fonts are substituted. This might cause layout issues. You can implement IWarningCallback to get a notification when font is substituted.

You should install Aspose.Words.Shaping.HarfBuzz package to be able to enable open type features.