# \includegraphics{<pdf image>} is dropping items (comments) from the <pdf image> file. Can pdfTeX support inclusion of PDF 1.6?

I have a pdf file, one page. When included in Latex using \includegraphics, the resulting image (in the compiled pdf) is not the same as what in the image pdf file that was included.

It dropped a letter in the formula. This might be due to the version number warning Tex Live is giving below or the warning about Subtype in Resources which I do not understand.

\documentclass[11pt]{article}%
\usepackage{graphicx}%
\begin{document}
\includegraphics[]{p}
\end{document}


The warning I get is

pdfTeX warning: pdflatex (file ./p.pdf): PDF inclusion: found PDF
version <1.6>, but at most version <1.5> allowed


Also

pdfTeX warning: pdflatex (file ./p.pdf): PDF inclusion:
Subtype in Resources dict is not a name (key 'Subtype', type <stream>);
ignored.>] (./foo.aux)


Here is pdfinfo about the image file p.pdf

pdfinfo p.pdf
Creator:        Canon
Producer:
CreationDate:   Fri Oct  7 10:25:56 2011
ModDate:        Tue Sep 29 13:04:09 2015
Tagged:         no
Form:           AcroForm
Pages:          1
Encrypted:      no
Page size:      455.352 x 177.466 pts
Page rot:       0
File size:      38071 bytes
Optimized:      no


Here is side-by-side showing the difference

I am using Tl 2015 on Linux. Here is a link to the folder with the pdf file p.pdf used in the above Latex MWE.

Here is the file list (I just did a tlmgr update --all again just in case) This is the current file list after the update

*File List*
article.cls    2014/09/29 v1.4h Standard LaTeX document class
size11.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
graphics.sty    2014/10/28 v1.0p Standard LaTeX Graphics (DPC,SPQR)
trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live
pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
supp-pdf.mkii
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
epstopdf-base.sty    2010/02/09 v2.5 Base part for package epstopdf
grfext.sty    2010/08/19 v1.1 Manage graphics extensions (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
p.pdf    Graphic file (type pdf)
***********


The question is: How to handle this problem? does one need to change the version of the pdf file itself, or change some configuration settings in TL itself?

Related question Problem including PDF 1.6 files in XeTeX with MikTeX

• @JohnKormylo I just run tlmgr update --all again, and the pdftex did not change versions, I saw it updating few other packages. pdftex remained at v0.06d as giving in the above list. I still get same warnings, and the problem remains. Running on Linux, TL 2015. Will update my question with the current filelist just in case. – Nasser Sep 29 '15 at 21:31
• Does this answer help? – Ian Thompson Sep 29 '15 at 21:32
• @IanThompson thanks, but it did not fix the problem. This is what I did \documentclass[11pt]{article}% \pdfinclusioncopyfonts=1 \usepackage{graphicx}% \listfiles \begin{document} \includegraphics[]{p} \end{document} compiled with pdflatex, looked at the pdf file, and it is still missing the s there. – Nasser Sep 29 '15 at 21:37
• @cfr I tried. but it is still missing. Here is example: \pdfminorversion=7 \pdfinclusioncopyfonts=1 \documentclass[11pt]{article}% \usepackage{graphicx}% \listfiles \begin{document} \includegraphics[]{p} \end{document}, I also tried just this \pdfminorversion=7 \documentclass[11pt]{article}% \usepackage{graphicx}% \listfiles \begin{document} \includegraphics[]{p} \end{document} no change. Letter is missing. – Nasser Sep 29 '15 at 21:42
• The link to the related question in your post is broken and I don't know what it is supposed to point to. Can you fix it? – cfr Sep 29 '15 at 21:46

The two error messages concern two distinct problems. The first is easily solved. The second less so.

# First problem: PDF cannot include a PDF which uses a higher version format

This is the first error message you get:

pdfTeX warning: pdflatex (file ./p.pdf): PDF inclusion: found PDF
version <1.6>, but at most version <1.5> allowed


By default, current pdfTeX produces PDF version 1.5. However, it can produce other versions, up to 1.7. In order to include a PDF which uses format version 1.6, your PDF should be at least version 1.6.

\pdfminorversion=6


for version 1.6 or

\pdfminorversion=7


for version 1.7 as the first line in your .tex file.

Note that 'first line' means first line i.e. this is not part of your preamble - it comes before \documentclass... etc. as the option needs to be set very early in order to be effective.

# Second problem: malformed PDF

This is the second error message:

pdfTeX warning: pdflatex (file ./p.pdf): PDF inclusion:
Subtype in Resources dict is not a name (key 'Subtype', type <stream>);
ignored.>] (./foo.aux)


Basically, the software which created the PDF appears to have produced a malformed PDF which pdfTeX cannot make sense of. The PDF viewer can make sense of it, apparently, although it certainly does not look right in mine. The font, spacing and alignment of the disappearing s looks wrong in your screen shot as well.

The real solution here is to persuade the creator software to produce a valid PDF. Apart from the malformation which renders the PDF invalid, no fonts are embedded which is also problematic (although this doesn't make the PDF invalid).

If that is not an option, I would first check what output should be displayed here and then either just typeset the required content normally or turn the PDF into a PNG and include that. The PNG option is not at all ideal, but if the other options aren't possible, it may be the best you can do.

• thanks again for the hint. But for some reason, it is still missing that letter. Here is what I tried \pdfminorversion=6 \documentclass[11pt]{article}% \usepackage{graphicx}% \listfiles \begin{document} \includegraphics[]{p} \end{document} and tried '7'. No change. I have the pdf image file in the link I posted if you like to try yourself. Also tried \pdfminorversion=6 \pdfinclusioncopyfonts=1 \documentclass[11pt]{article}% \usepackage{graphicx}% \listfiles \begin{document} \includegraphics[]{p} \end{document} and no change. letter still missing. – Nasser Sep 29 '15 at 21:45
• @Nasser Please see my edit. The PDF is not valid. That's the basic problem. It is complaining that it doesn't match the specification which pdfTeX uses to make sense of the content. And I'm not clear whether the PDF viewer is doing much better - presumably, even if s is correct, it shouldn't look quite like that! ?? – cfr Sep 29 '15 at 22:04
• @cfr --- The 's' has been inserted as a pdf comment. – Ian Thompson Sep 29 '15 at 22:04
• Converting to png worked for me (but not pdf). – John Kormylo Sep 29 '15 at 22:45
• @cfr I am sure the 's' was added by the instructor later on. I know it does not look the same as the other fonts. But since it is "inside" the pdf file, I assumed it will show up in Latex. I thought whatever shows up on the screen when looking at the pdf file, will also show up when including the pdf file in Latex as graphics. I'll just take screen shot for now and save to png and use png for this one problem. Screen shot always works ;) – Nasser Sep 29 '15 at 22:50

The disappearing 's' is a pdf comment (annotation). The problem will go away if you 'flatten' the pdf so that this is no longer the case. One way to do this is to print the pdf into another pdf. On a Mac I open the file in Preview or Skim (not an Adobe product since these block the procedure) and go to File -> Print, then click PDF -> Save as PDF and enter a new filename. You will probably need to crop the new image.

• If I open the pdf in Preview I don't see the letter 's', but the letter 'e' appears in several places. There is also some text at the top about Homework Set #3. The file seems to have some problems. – erik Sep 29 '15 at 22:12
• @erik --- The text at the top is partially cropped. I don't see the extraneous instances of 'e' though. – Ian Thompson Sep 29 '15 at 22:15
• I see them with Preview, but not with Acrobat. The text about a homework set appears in both viewers, but in slightly different positions. – erik Sep 29 '15 at 22:19
• I used pdftk to flatten the PDF and still got the same problem. It is part of an annotation, but the structure of the annotation doesn't seem to be correct. – cfr Sep 29 '15 at 22:20
• @cfr --- I tried pdftk as well; it didn't work for me either. Printing to a new pdf seems to fix the problem (at least on my machine). – Ian Thompson Sep 29 '15 at 22:22