Skip to main content
Participating Frequently
October 12, 2017
Question

Collapse pdf layers and components into an image

  • October 12, 2017
  • 1 reply
  • 2204 views

I have pdf documents where each page is an image. Sometimes there is an annotation object (a Comment),  a field object (a textbox), or even another smaller image on top of the main page image. I would like to collapse all of these objects and the underlying main page image into one image, per page.

Is there a way of doing this in Actions or Javascript? Or maybe even a third party python library?

There is a preflight called "flatten annotations and form fields". The name seems to suggest it is exactly what I am looking for. But after running it, the only thing that's different is that when I go to the Comment menu and click "Comment List" it says : this document has no comments. However, if I select "Edit text & images" and resize the page image by dragging the image icon on the top left corner of the screen, the page image will shrink but the original Comment objects stay put. What I really want is for those Comment objects to become part of the image and "move" with the main image when I drag and resize the image.

This topic has been closed for replies.

1 reply

Dave__M
Community Expert
Community Expert
October 13, 2017

You may want to try to print your document (I know it is a PDF already) to to PDF, which should flatten it.  Let us know if it works.

My best,

Dave

Dov Isaacs
Legend
October 13, 2017

Using the “refry” process will not convert the annotations to an image or merge same into the main image itself. They will remain text and/or vector.

There is no simple way to do what you want, although the first step is obviously to use the Acrobat Pro Preflight fixup as you described.

One long nasty way to fix this is to save the PDF file and then open same in Photoshop, select the page number (and options), and resave the page as a new PDF file. Note that this would need to be done one page at a time! And you need to reassemble the single page totally image PDF files into a new multipage PDF file.

     - Dov

- Dov Isaacs, former Adobe Principal Scientist (April 30, 1990 - May 30, 2021)
Participating Frequently
October 13, 2017

Since I have thousands of pdfs and it needed to be automated here is how I did it:

1- Run an Action to save each pdf as TIFF (one TIFF file is generated per page per document)

2- Using pillow and reportlab used python to reassemble the original pdfs from generated TIFFs

I used the python code from here:

Batch convert TIFF images to PDF ImageMagick Python - Stack Overflow