linkedinfacebooktwittermenuarrow-up

GemBox Support Forum

Word to PDF conversion layout problem

I’ve simple two pages word file (.docx) and using this code to convert to PDF.

            // If using Professional version, put your serial key below.
            ComponentInfo.SetLicense("FREE-LIMITED-KEY");

            // In order to convert Word to PDF, we just need to:
            //   1. Load DOC or DOCX file into DocumentModel object.
            //   2. Save DocumentModel object to PDF file.

            GemBox.Document.FontSettings.FontsBaseDirectory = @"D:\Projects\API\PDFService\PDFService\Fonts\";
            DocumentModel document = DocumentModel.Load("d:\\testinputWordFile\\P1.docx");
            
            document.Save(".\\temp\\Output.pdf");

I’ve put 1 font family into the reachable folder, and the result seemed to be with the correct font. But the layout/tabbing/paragraphing is much different.

The result is very much different from using MS Word’s SaveAsPDF option.

Anyone can suggest, much appreciated in advance.

Can you please send us your “P1.docx” file and the font files in the “Fonts” folder so that we can reproduce your issue and investigate it?

Thank you Mario,
I’ve sent them to info@gemboxsoftware.com.

Regards,
Shin

Hi Shin,

Unfortunately, the problem occurs because the document uses ‘thaiDistribute’ alignment.
GemBox.Document currently doesn’t have support for this in the rendering engine, instead, it uses ‘Justified’ alignment.

Note that I have created an internal support ticket for this feature in which we’ll keep track of its priority.
But at this moment, I cannot tell you exactly when it will be implemented.
Please note that we prioritize feature request implementations by the number of users requesting them and currently we are working on some other features that have greater priority (more user requests).

Regards,
Mario