Free Support Forum - aspose.com

Save word document as pdf using Aspose word java

Hi There,

We recently bought Aspose words for Java.

We are using same for converting some standard word 2007 documents to PDF files. Previous to this we were using MS word’s save as pdf feature to convert word documents to pdf.

As per our business requirements both documents need to be exactly similar after pdf conversion. But when comparing 2 documents i.e., one produced by MS Word save as pdf feature and Aspose’s save as pdf feature both are not exactly same.

We observed multiple difference patterns:

1> words are getting shifted to other line.
2> additional spaces are introduced.
3> There is slight difference in the font types.
4> Decimal numbers are formatted like: .456 is converted to 0.456 by aspose.

Can you guyz please suggest if there are any specific parameters that we need to set while conversion, we are using everything as default. Are we missing something here. I checked compliance of both pdf files which is same.

I am also attaching few screenshots from our outputs1.JPG (251.4 KB)
2.JPG (270.9 KB)
. The right side is one generated by Aspose and left side is the MS word pdfConvertor utility.

@aayushag85,

Thank you for your interest in Aspose.Words. To ensure a timely and accurate response, please ZIP and attach the following resources here for testing:

  • Your input Word document
  • Font files used in this Word document (see True Type Fonts)
  • Aspose.Words 18.11 generated output PDF file showing the undesired behavior
  • Your expected PDF document showing the correct output. You can create expected document by using MS Word.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

Hi

I am uploading zip file with all the required files here. We are not embedding fonts along with the word file. One important point we are using Aspose 17.8 version for this conversion.
ZipFile.zip (297.4 KB)

Thanks

Aayush

@aayushag85,

You are using a very old version of Aspose.Words for Java i.e. 17.8 on your end. Please upgrade to the latest version from the following link.
https://downloads.aspose.com/words/java

Please also try using the following code on your end.

Document doc = new Document("D:\\ZipFile\\OriginalWordDocument.docx");
doc.getCompatibilityOptions().optimizeFor(MsWordVersion.WORD_2010);
doc.save("D:\\ZipFile\\awjava-18.11.pdf");

Hope, this helps.