Blank page added while convert from doc to pdf

Hi,


I have the an issue that empty page is generated at the end of the PDF document while converting from Word Document to PDF.
I don’t find the Page.delete operation is not available in my available JAR files.
Can you please guide us to provide the valid solution any of the below requirement.
We are using Word Mail Merge feature to generate the Word document, after the document generated successfully with all the data, then we are converting the Word document to PDF document.

1. PDF should be generated with out having any blank pages.
2. Sample code to delete the blank PDF page.

Below are the JAR files i am using.
1. aspose-words-15.9.0-jdk16.jar
2. aspose-pdf-4.3.0.jar
3. aspose-pdf-4.3.0-jdk14.jar

Hi,


Thanks for your inquiry.

We would suggest you please upgrade to the latest version of Aspose.Words for Java 15.11.0 and see how it goes on your side. Hope, this helps. You can download it from the following link:


In case the problem still remains, please attach the following resources here for testing:

  • Input Word document
  • Aspose.Words generated output Word document which shows the correct output
  • Aspose.Words generated output PDF document which shows the additional page(s)
  • Please create a standalone simple Java application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing…

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

PS: To attach these resources, please zip them and Click ‘Reply’ button that will bring you to the ‘reply page’ and there at the bottom you can include any attachments with that post by clicking the ‘Add/Update’ button.

Best regards,

Hi,

I have company level restrictions to upload our sample code to you, whether it contains any business data or not. Can you please help us by providing sample code to achieve the above requirement. Meanwhile i will try to get the approval to provide you the sample code.

Steps we followed:
1. Create a sample word document.
2. Added mail merge fields to the above created document.
3. Using Aspose API, we are dynamically replacing the mail merge fields with real data. For few mail merge fields we are populating through data table(Data contains more than one record).
4. Using Aspose API, we are generating PDF by using above document.
5. The above generated document contains one blank page, if data ends at the end of the previous page.

We also tried below options as well.
1. Downloaded latest API and verified.
2. By identified the getContents and getAnnotations API’s identified the empty page and tried to delete page, but page is not getting deleted, even the PDF document getting tampered. Here, we are getting more than 0 value for getContents API call for blank page.
3. We also verified REMOVE_EMPTY_PARAGRAPHS and REMOVE_UNUSED_REGIONS properties.
4. However, we verified the above all approaches in an standalone application, but we didn’t get any breakthrough.
Hi,

Thanks for your inquiry. Unfortunately, it is difficult to say what the problem is without the documents and other required resources as mentioned in my previous post. We need these resources to reproduce the exact problem on our end.
Please note that it is safe to attach files in the forum. If you attach your documents/files here, only you and Aspose staff members can download them. Also, you can zip them and send the file to my e-mail as described here:

How to send your license file to an Aspose staff member?

You can also carefully remove any sensitive information by replacing it with dummy data instead.
Best regards,