Hello,
We are encountering additional formatting issues when we upgraded Aspose - from 15.5 to 21.4 recently and the documents have below listed problems when generated to PDF.
I have created two projects with related versions which generates PDFs as we do it in our app. The template and steps are same. Both using minimalTemplate.docx which is in zip aspose project services.zip (880.3 KB)
The template is working fine in 15.5 but it causing the issue in 21.4.
We would like to ask you what changed or what we do wrong/ need to change in order to make it work. We would like to have some workaround instead of changing it in every template.
I am afraid, we could not locate the source template Word document “minimalTemplate.docx” inside the “aspose project services.zip” archive that you attached in previous post. Also, please upgrade to the latest (21.7) version of Aspose.Words for Java and see how it goes on your end? In case the problem still remains, then can you please reattach source Word template file here for testing?
This bar is even present in “output1505.docx” and “output1505Result.docx” documents. When you convert these Word documents to PDF formats manually by using “Save As” command of MS Word 2019, then you will notice that MS Word renders this blue bar in output PDFs which is similar to what latest versions of Aspose.Words produce. So, this seems to be a bug in old version of Aspose.Words for Java.
Can you please provide comparison screenshots highlighting (encircle) the above mentioned problematic area(s) in Aspose.Words 21.7 generated output and attach them here for our reference? We will then investigate these issues further and provide you more information.
Empty blue bar::
It works fine in the Aspose version15.5. No issue for this version. The doc file contains the template. It is generating the PDF file correctly in Aspose 15.5.
Bu,t it not working fine in 21.4. Please check the generated PDF file.
So, this seems to be a bug in 21.4 version of Aspose.Words for Java.
minimalTemplate.docx - When you open this file with MS Word 2019, you will notice MS Word 2019 displays that blue paragraph shading color in its editor.
minimalTemplate - ms word 2019.pdf - This file was produced by using “File | Save As” command of MS Word 2019. The blue shading color also appears at the end of this MS Word 2019 generated PDF.
minimalTemplate - Aspose.words 21.7.pdf - This file was produced by using the following simple code of latest 21.7 version of Aspose.Words for Java. Again, the blue shading color appears in this PDF. In this case, the latest 21.7 version mimics the behavior of MS Word 2019.
minimalTemplate - Aspose.words 15.5.0.pdf - This file was also produced by using the following simple code of old 15.5.0 version of Aspose.Words for Java. But unlike the above two PDFs, the blue shading color is not visible in this PDF. Most likely because of a bug or a missing feature, in this case, the old 15.5.0 version does not mimic the behavior of MS Word 2019.
License lic = new License();
lic.setLicense("Aspose.Words.Java.lic");
Document doc = new Document("minimalTemplate.docx");
doc.save("output.pdf");
However, if you don’t want to see the empty blue bar in the PDF output produced by latest 21.7 version of Aspose.Words, then you may want to optimize for MS Word 2010.
public void generateDoc() throws Exception {
List<String> empty = new ArrayList<String>();
Document doc = new Document(fileTemplate);
doc.getCompatibilityOptions().optimizeFor(MsWordVersion.WORD_2010);
MailMerge mailMerge = doc.getMailMerge();
mailMerge.setUnconditionalMergeFieldsAndRegions(true);
...
...
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.