# How to keep all added markings/notes in pdf when using includegraphics?

The following is the is the scenario. I write the HW in latex, compile to PDF, upload to school website. Teacher grades the PDF adding marks and notes in red directly to the PDF (I assume they use some tool to do this, or may be use PDF own notes tools).

I download the graded PDF file. I like to include it to my main course document again, using \includegraphics. But the markings in red are all lost and do not show in the final PDF document.

I can see the red marking on the screen when I open the graded PDF on its own using adobe PDF read. I also can print the graded PDF and the printed pages show the red markings.

It is only when I include the graded PDF, they do not show again the final PDF.

Here is MWE

\documentclass[12pt]{article}

\usepackage{graphicx}
\begin{document}

\includegraphics[width=0.8\pagewidth,page=1]{p}

\end{document}


the file p.pdf used above is one graded page to show the problem. Please find it here p.pdf (safe link, it is my own web page)

Any idea why this happens and how to fix it?

Do I need to do something to the graded pdf itself before including again in Latex so that the added notes and marking show up?

One option I could do is this, which works: Print all the pages of the graded PDF. Then scan them all again using the scanner to new PDF file. Now the resulting PDF will have these marking embedded in them as images, and they will show up if I include the scanned version of the PDF in my main document.

But this is too much work, and the quality of the scanned PDF is not as good as the original.

Any suggestions what to do? I use lualatex to compile Latex if this makes any difference.

Update I tried the flare package but it does not show the markings. Here is what I tried

\documentclass[12pt]{article}
\usepackage{flare}
%\usepackage{graphicx}% it seems flare loads graphicx automatically

\begin{document}
\includegraphics[scale=0.9,page=1]{p}
\end{document}


And now

(base) >lualatex foo.tex
This is LuaHBTeX, Version 1.12.0 (TeX Live 2020)
restricted system commands enabled.
(./foo.tex
LaTeX2e <2020-10-01> patch level 2

L3 programming layer <2020-12-07> xparse <2020-03-03> (/usr/local/texlive/2020/texmf-dist/tex/latex/base/article.cls
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/size12.clo)) (/home/me/texmf/tex/latex/flare/flare.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/l3kernel/expl3.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-luatex.def))) (/usr/local/texlive/2020/texmf-dist/tex/luatex/luatexbase/luatexbase.sty (/usr/local/texlive/2020/texmf-dist/tex/luatex/ctablestack/ctablestack.sty)) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/graphicx.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/graphics.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/trig.sty) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-cfg/graphics.cfg) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-def/luatex.def))) (/usr/local/texlive/2020/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/etoolbox/etoolbox.sty)) (./foo.aux) (/usr/local/texlive/2020/texmf-dist/tex/latex/base/ts1cmr.fd) (/usr/local/texlive/2020/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
) (/usr/local/texlive/2020/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))

Module Flare Warning: Annotation of type 'Widget' not supported. on input line 8
Module Flare Warning: Annotation of type 'Ink' not supported. on input line 8
Module Flare Warning: Annotation of type 'Ink' not supported. on input line 8
Module Flare Warning: Annotation of type 'Ink' not supported. on input line 8

Overfull \hbox (180.86038pt too wide) in paragraph at lines 8--9
[][]
[1{/usr/local/texlive/2020/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
Overfull \vbox (166.9664pt too high) has occurred while \output is active [2<./p.pdf>]
(./foo.aux))
(see the transcript file for additional information)
406 words of node memory still in use:
3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 48 glue_spec, 4 attribute_list, 1 write nodes
avail lists: 1:2,2:33,3:8,4:2,5:22,6:2,7:29,9:30
</usr/local/texlive/2020/texmf-dist/fonts/opentype/public/lm/lmroman12-regular.otf>
Output written on foo.pdf (2 pages, 25355 bytes).
Transcript written on foo.log.
(base) >


It looks like the annotations added to the PDF are not support by flare package at this time. The generated PDF files do not show the annotation/markings in the p.pdf file.

I added a discussion at github on this to the author of flare package, and put a link to this post also.

• Annotations are stripped when a graphic is included. The newpax package allows to reinsert links, and the project works on markup annotations github.com/AndreasMatthias/Flare Jun 10 '21 at 6:29
• @UlrikeFischer thanks. I tried it now, but it does not work. I'll post detailed in my question now. Jun 10 '21 at 6:53
• Better add an issue to the github. This a quite new project. Jun 10 '21 at 7:04
• @UlrikeFischer Yes, I just did, under discussion in the flare link, and put a link there to this question also. Thanks. Jun 10 '21 at 7:06
• I added support for /Ink annotations a few days ago but missed to push a new release. Please download the latest release from github again. /Widget annotations are not supported yet, but I'm working on it. Jun 10 '21 at 9:10

The default conversion for PDF->GIMP is 100 DPI which is inadequate, but can easily be modified (600 DPI). The following image was obtained by deleting everything that wasn't red. (Tools->Selection Tools->Select by Color, Select->Invert, Edit->Clear).

The background is transparent, so you can overlap the two images.

\documentclass{standalone}
\usepackage{graphicx}
\begin{document}

\rlap{\includegraphics[page=1]{p.pdf}}%
\includegraphics{p.png}

\end{document}