Hi.

 

I am currently using iText to create and copy PDFs. I have some pdfs that have blank pages (no text, no image), and I would like to detect and remove those pages when I come across them.  If I can detect them, then I can remove them, however I’ve had trouble detecting them. Any suggestions?

 

This is the code I am using to read the pages.

 

PdfImportedPage page;

PdfReader reader = new PdfReader(path);

reader.consolidateNamedDestinations();

int n = reader.getNumberOfPages();

document = new Document(reader.getPageSizeWithRotation(1));

writer = new PdfCopy(document, new FileOutputStream(outFile));

document.open();

for (int i = 0; i < n; ) {

  ++i;

  page = writer.getImportedPage(reader, i);

// I know I need to modify something in this space.

  writer.addPage(page);

}

 

Disclaimer: this is based off of sample code

Dan

 

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to