8

Using \includegraphics[width=\linewidth]{mypdf} I tried to insert a PDF image to my XeLaTeX document. But instead of the images empty area places in its place.

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=\linewidth]{my.pdf}
\end{document}

I got following in console:

** WARNING ** Multiple DecodeFilter not supported.
** WARNING ** Could not handle a content stream.
** WARNING ** pdf: image inclusion failed for "./my.pdf".
 )
(see the transcript file for additional information)
Output written on test.pdf (1 page).
SyncTeX written on test.synctex.gz.
Transcript written on test.log.

What may be wrong? What kind of PDFs can be inserted in tex files?

Real Dreams
  • 8,298
  • 12
  • 56
  • 78

3 Answers3

9

This is a result of multiple decoders within the original PDF (as the message clearly states). A solution is to convert the PDF to PostScript and then back again to PDF, which should encode it using a single decoder.

For this you would need Ghostscript and perhaps Xpdf (which provides pdftops, if pdf2ps is not available). The conversion back to PDF should come standard with your TeX distribution in the form of epstopdf.

If this conversions results in a larger PDF than the original, you might consider running the intermediate PS through ps2ps first, before converting back to PDF.

In summary:

pdftops  foo.pdf 
epstopdf foo.ps 
pdfcrop  foo.pdf
Werner
  • 603,163
2

use

\documentclass{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[width=\linewidth]{my.pdf}
\end{document}

for multiple pages, or

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=\linewidth,page=<pageNo>]{my.pdf}
\end{document}

for a single page

-1

I have found a possible solution from

Cropping/Trimming an image with includegraphics by specifying percentages

Trying the following TeX code:

\adjustbox{trim=5cm 5cm 5cm 5cm, clip}{\includegraphics[page=2]{source.pdf}}
  • Welcome to TeX.SX! While the advice is sound for different kinds of problems, I don't see how it handles the present one. – egreg Dec 26 '14 at 21:19