I usually prefer PDF images for my LaTeX documents because they are easy to crop/resize using Adobe professional. I am facing a weird problem. I modified one of the PDF images using Adobe professional by writing come comments using the pencil tool and added a rectangular box on the image and saved it. The LaTeX output is not showing the modification that I made to the image file but when i open the image file the modifications are still there. Did anyone face similar problems?

  • 2
    Are the comments perhaps annotations? Or, elaborate more on how you added the "comments" to the existing PDF.
    – Werner
    Commented Nov 2, 2011 at 5:43
  • 4
    Yes, PDF annotations (notes, hyperlinks, etc.) will be lost in included PDFs. See the accepted answer to How to preserve hyperlinks in included pdf?. Commented Nov 2, 2011 at 6:47
  • I found a quick and dirty way to do this. The original pdf image can be opened and edited in image editing softwares such as Corel Draw and saved back to pdf. Output image quality is excellent and it will retain all the modifications. This won't work for hyperlinks though.
    – John Smith
    Commented Nov 4, 2011 at 5:04
  • 1
    I also can recommend the free PDF annotator xournal. It saves back to PDF without rasterising. You should definitely pay attention that you don't rasterize your PDF.
    – Marco
    Commented Nov 7, 2011 at 23:12
  • 2
    Maybe you could post your solution in the form of an answer so that this question can be marked so (you can answer your own questions and accept them as well) :)
    – mpr
    Commented Nov 13, 2011 at 6:41

7 Answers 7


One way to do this preserving the vector form would be to use the Adobe Acrobat "Preflight" tool, which allows you to "flatten" your comments ("Flatten forms and annotations"). I tried to show you an example, but it comes reversed! Maybe it's a bug of version X. :(

Another way inside Acrobat it's to open a console (Ctrl-J) and then execute the command flattenPages() which I can confirm it's working in my version of Acrobat and it's correctly compiled in vector form by pdfLaTeX. The output is like this.

A third option to selectively flatten your content would be one of the several scripts of the Adobe Exchange like this one (there's plenty of others) in case that


The problem is that the annotations are added to the PDF on a separate layer, in a way not handled by many tools that embed PDFs in other PS/PDF content. Thus you have to flatten the annotations - turn them to ordinary PDF primitives - for them to show up.

On OS X, the annotation flattening is done from Preview via "Export to PDF".

Here is the workflow I use to annotate photographs:

  1. Open any image file in Preview.
  2. Optionally reduce the size to keep the file size down.
  3. Export to PDF - this will be the editable annotated file.
  4. Open the PDF in Preview.
  5. Add annotations to the PDF. They are editable if you reopen the file later with Preview.
  6. Export to PDF - this will be the flattened file that shows up correctly in pdflatex output etc.
  • 2
    Thanks, however when I do this the exported PDF has an A4 or US Letter format, which the original file did not have ; in other words it puts the original content in a big white page. This makes it impractical for Latex purposes. Any solution?
    – Arthur
    Commented Mar 19, 2018 at 16:01
  • @Arthur You can crop it, although there is a way to use PdfKit directly to avoid the big white page problem I believe. It'd require some coding, though. Commented Mar 19, 2018 at 18:34

GhostScript can flatten PDFs. Try putting this in a file on your PATH (like /usr/local/bin/flattenpdf) and making it executable:

gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sPDFPassword='' -dPDFSETTINGS=/prepress -dPassThroughJPEGImages=true -sOutputFile="${1%.*} (Flattened).pdf" "$1"

Then just use flattenpdf yourpdffile.pdf to create a flattened version.

also it removes password restrictions from PDFs

[EDIT Sept 2023] Following Ghostscript version 9.21 this does not work any more (gs preserves the annotation layer that is in a sense good), but there is a flag for that: -dPreserveAnnots=false. A new version of the script (that works for me) would be:

gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sPDFPassword='' -dPDFSETTINGS=/prepress -dPassThroughJPEGImages=true -dPreserveAnnots=false -sOutputFile="${1%.*} (Flattened).pdf" "$1"

In Mac OS, crtl+p to print and 'save to pdf' work for me.

  • How does this solve the given issue by OP? Can you please explain better? Welcome to TeX.SE!
    – Mensch
    Commented Aug 19, 2022 at 15:41
  • 1
    Thanks a lot! This worked for me. I did open pdf on Chrome, ctrl+p to print, and save it as pdf. Commented Mar 7, 2023 at 17:49

I met a similar problem when I add a line in my pdf using pdf editor, but the line didn't show in the pdf file generated from latex.

I just solved this problem by opening my pdf file using the Word, and then modify it using the Word. Then, the modified word can be resaved back to pdf, it works.

Amazing! You can try it.


I had the same problem. I solved it by using the cutePDFwriter. Open the pdf file with annotations, then go crtl+p to print and use cutePDFwriter to save the file again. Then the annotations will be shown in the compiled file.


This simple solution worked for me. Print that annotated pdf and in the printer selection box, choose- 'Microsoft print to pdf'. This will flatten the pdf. Now, include the newly generated pdf in your latex.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .