Blank pages are added in file

Here I am attaching a source .docx file converted to pdf using aspose in java.
Please notice an addtional blank page being added to the final pdf.
Is there a way where we can avoid this addition of blank page.Leadership Style.docx (61.9 KB)
Leadership Style.pdf (211.3 KB)
Leadership Style.docx (61.9 KB)

@TandFSP

Can you please share the sample code snippet as well that you used for the conversion? We will test the scenario in our environment and address it accordingly.

@TandFSP This is an expected behavior. There is a section break odd page at the end of the first page in your document. So the next page is actually the third page, not the second. If you convert your document to PDF using MS Word you will see exactly the same result. If you need to avoid such behavior you can change section break type in the code. For example see the following code:

Document doc = new Document("C:\\Temp\\in.docx");
for (Section s : doc.getSections())
{
    int start = s.getPageSetup().getSectionStart();
    if (start == SectionStart.EVEN_PAGE || start == SectionStart.ODD_PAGE)
        s.getPageSetup().setSectionStart(SectionStart.NEW_PAGE);
}
doc.save("C:\\Temp\\out.pdf");
1 Like