I have a huge PDF document (several hundred pages) which was very likely produced from a PowerPoint presentation.

It contains one page per presentation step, so if on one PowerPoint slide there was some text or an image that appeared later with an animation, there will be two pages in the PDF: one with only the initial content of the slide and one with the animated object added.

I do not have access to the original presentation, only the PDF.

Now is there a way (script, application, ...) to automatically remove all redundant pages and only keep the last page with all information of each set of pages per original slide, discarding the incomplete pages with the animation steps?

The check algorithm would actually be quite simple: for each page, check whether the following page contains at least all information (text, images, objects) from the current page or more, and if so, remove the current page.

Unfortunately I have no idea whether or how it is possible to compare pages of PDF documents and find out whether the elements of one are a subset of the other or not.

Can you give me any solution that helps me to tidy up my huge PDF document and remove the animation steps in order to print it out?

I do not really want a PDF editor application where I have to check and remove all the pages manually anyway, I already have https://www.xodo.com/ for that. What I hope for is a way to automate the process.


Have you looked into pdfbox? You can invoke its various features from the command line. You can extract each page as text, use diff to see if each successive page has mostly additions to the previous one, keep track of the interesting pages, then use pdfbox again extract only those pages.

I assume from your rating that you don't need detailed instructions for how to accomplish all this :)

  • 1
    I think this would fail if the added content is an image, the two pages would have same text extracted. – Andrea Vacondio Feb 22 '17 at 18:56
  • I appreciate your response, but generally each Q&A here should be intended to be useful for every visitor, regardless of their knowledge. Therefore it's a good thing to talk to everybody as if they were five. Also if you are familiar with that tool, it's easier for you to quickly smash some working commands together that do at least roughly what the question wants than if I have to start reading the manual from zero... Depending on how much time your answer saves me, I might also possibly feel generous with a bounty, so that your efforts would be at least rewarded with some internet points. – Byte Commander Feb 22 '17 at 20:32
  • I already pointed to the CLI commands that the tool authors have kindly provided. – JayEye Mar 4 '17 at 21:44

If a desktop app instead of a command line tool is acceptable, you can try the Combine and Reorder module of PDFsam Visual (it's free and fully functional for 14 days). It shows pages thumbnails, you can scroll all the hundreds of pages and remove the ones you want to discard. It's a bit of manual labor but I doubt you will find a tool that automatically does what you asked.

You talked about huge PDF document so PDFsam Visual might fail with standard settings, in that case write us and we can try some different setting.

Disclaimer: I'm one of the authors.

  • 2
    If you're affiliated with the software suggested in your answer please disclose that affiliation. Otherwise your answer risks being flagged as spam. – David Foerster Feb 22 '17 at 19:17
  • I already have an editor that allows me to view the PDF pages as thumbnails and delete or rearrange them. I'm hoping for an automated solution. – Byte Commander Feb 22 '17 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.