We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Install Same Version of Fonts to Get Same Word to PDF File Size on Various OS Java | PDF Rasterization

Hello,
we have found a difference (in size) between two PDFs generated on Windows 10 and Windows Server 2019.
Graphically the files, when opened in reader, are looking the same, but the PDF content is different in size (image stream). As we have automated tests verifying the generated PDF parts content, this leads to a false positive.
The test is very simple:

final Document doc = new Document(“pqltestpdfa.docx”);
doc.save(“pqltestpdfa.docx.PDF”);

and the above code has been run on Windows 10 and Windows Server 2019 using the same version of Java machine (1.8.202-b08). The Aspose.Words for java library used is the version 20.8.
Is there an explanation about the difference in bytes between the 2 PDF files?
Attached the input docx used and the output PDFs generated on both systems.
Additionally, we have found differences when generating on Windows 10 with different builds: the PDF generated on Windows 10 build 1809 is different in size vs. the 1909.
Many thanks in advance.
Gianfrancopqltestpdfa.zip (166.9 KB)

@gianfranco.dancelli,

We have logged this problem in our issue tracking system. Your ticket number is WORDSNET-21053. We will further look into the details of this problem and will keep you updated on the status of the linked issue. Sorry for the inconvenience.

@gianfranco.dancelli,

During further investigation we have found that there is no difference in image streams in your provided files but we see the difference in font streams and page content streams. Probably the font environment is different on your different OS. The same may be applied to different Windows builds because fonts are periodically updated with Windows updates. Aspose.Words cannot produce the same PDF output with different fonts. If you want to compare the PDF contents, you should at least provide the same font environment for Aspose.Words.

Also, a more resilient approach to compare PDF files is to rasterize the PDF files and compare the images. PDF rasterization could be done with third-party PDF tools like Aspose.PDF. This comparison approach may help to overcome minor font updates and minor changes in PDF output in subsequent Aspose.Words updates.