GemBox Support Forum

Created PDF smaller than original DOCX

I am just starting to evaluate GemBox.Document, so I am very new here. I have a 26-page docx. When I use Office to save as a PDF, I get a 26-page PDF that looks like the original DOCX. But when I use a GemBox.Document sample program to save it as a PDF, the PDF fits a little bit extra on each page, resulting in a 25-page PDF. I need the PDF to be true to the DOCX paging.

I added code to GetPaginator on the loaded docx then save the pdf page by page - I see that the pages count is 25 instead of 26. Why is this happening on a 26-page docx?

Thanks for any help you can offer

Hi Linda,

Unfortunately, without investigating your DOCX file I cannot say anything for sure.

But nevertheless, note that GemBox.Document does not use Microsoft Word to calculate positions and sizes of document elements on the page, therefore the results might not be identical since MS Word’s layout/rendering engine is not standardized nor its code is open.

GemBox.Document, just like any other Word application, uses its own layout/rendering engine to paginate and render the document’s content. We do not have MS Word’s rendering engine source code, no one does, but we do try to provide the exact MS Word calculations as much as possible. However, again I’m afraid that some differences may occur.

But note that you may notice similar differences when opening your document with other Word applications as well. For example, please try opening your document with LibreOffice Writer, Microsoft Word for Mac, Microsoft Word Online, etc.
Actually, these kinds of differences may even occur between different versions of Microsoft Word itself.

Anyway, you can think of this the same to how different browsers can render the same HTML page slightly differently.
If you need to have a 100% the same result then I’m afraid your only option is to use exactly the same version of Microsoft Word which you’re using as a base for comparison.
Note that some solutions can be more accurate than others, but I’m afraid that no one can guaranty you 100% accuracy with Microsoft Word.


Your response was very helpful. Focusing on just the resources that Word makes available, I was able to find the Microsoft.Office.Interop.Word library to create a simple vb net program that does the conversion with the exact same rendering engine so with the exact same result PDF. I appreciate it.