Import PDF file into XeLaTeX gives "pdf_link_obj(): passed invalid object" error
Asked Answered
C

3

6

I'm trying to import a PDF into a XeLaTeX using \includepdf{xyz.pdf}. The file xyz.pdf is a scan created by a Xerox 5755 machine, and PDF version 1.3.

The error I get is:

   ** WARNING ** No valid name object found.
   ** WARNING ** Could not find a value in dictionary object.
   ** WARNING ** Didn't find "endobj".
   ** ERROR ** pdf_link_obj(): passed invalid object.

I've tried normalizing the PDF by running pdftk xyz.pdf output xyz2.pdf, and that does resolve the issue — but only for some PDF files, with no obvious relationship between those files pdftk fixes and those it does not. There are always some files normalized with pdftk that continue to exhibit the exact same error as the unnormalized file.

I've tried searching for a solution to this issue and come up with this thread: XeLaTeX problems with includegraphics, which suggests that the problem can be solved by using the -output-driver=xdv2pdf, or alternatively by using pdf(la)tex. Alas, I can't use PdfLaTeX because I need XeLaTeX's unicode support. As well, I'm using Linux so I can't use the Mac-specific xdv2pdf.

I'd be very much obliged for any thoughts and input on why these PDF's are failing to be loaded by XeLaTeX, and — better still — how one might 'fix' these PDFs.

Kind regards,

Brian

Candlelight answered 5/11, 2010 at 20:59 Comment(1)
Got the same issue. I tried xelatex -no-pdf latexdoc.tex then xdvipdfmx -V 5 latexdoc.xdv to use a newer version of PDF, but it didn't fix the issue.Borax
P
4

Luatex (successor to Pdftex) also supports Unicode natively. What happens when you try compiling using lualatex?

Plausible answered 6/11, 2010 at 10:50 Comment(1)
Almost 12 years later this answer still solved my issue.Bygone
K
2

I had the same issue using XeLaTeX on Debian. PDFs exported from LibreOffice were imported properly, while including scans as PDFs which were created by my printer failed.

I could fix this issue by "re-compilig" the PDF with Ghostscript. On Linux this would be done with:

gs -o repaired.pdf -sDEVICE=pdfwrite dPDFSETTINGS=/prepress corrupted.pdf

(source: https://superuser.com/a/282056, there's also the Ghostscript command for Windows)

Importing the "repaired" PDF with XeLaTeX worked fine.

Knurl answered 15/6, 2017 at 10:18 Comment(0)
L
0

I was using \includegraphics{} and struck a similar problem with a pdf (created by printing a file from Excel using Win2pdf). I opened the pdf with Adobe Reader and saved a copy. The copy was then successfully incorporated using \includgraphics{} and the xelatex compiler.

Lefty answered 28/8, 2017 at 3:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.