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

Free Support Forum - aspose.com

Remove Empty Page from a PDF Document using Aspose.PDF for Java

Hi Team,

I have a licensed version of aspose pdf and I need to remove an empty page which has an header and a footer. Please, help me in finding a solution for this in java.

Thanks,
Aditya

@AdityaSingh

If page contains header and footer, it cannot be detected as an empty or blank page. As far as removing a page is concerned, you can remove it using Aspose.PDF for Java. In case of any further assistance, please feel free to let us know.

Hi,

Thank You for your response. So the syntax would be directly to use the delete() right?

doc.getPages().delete(16);

Something like this?

So the pdf has header and footer and the rest of the page is blank. So can we find that?

Thanks,
Aditya

@AdityaSingh

Yes, your understanding is correct.

As shared earlier, a page cannot be detected as blank if it has a header and footer because header/footer is not a separate entity in the PDF. Instead, they are treated as the content of the page.