简体   繁体   English

将 PDF 文件导入 XeLaTeX 会出现“pdf_link_obj():传递无效对象”错误

[英]Import PDF file into XeLaTeX gives "pdf_link_obj(): passed invalid object" error

I'm trying to import a PDF into a XeLaTeX using \\includepdf{xyz.pdf} .我正在尝试使用\\includepdf{xyz.pdf}将 PDF 导入 XeLaTeX。 The file xyz.pdf is a scan created by a Xerox 5755 machine, and PDF version 1.3.文件xyz.pdf是由 Xerox 5755 机器创建的扫描文件,PDF 版本为 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.我尝试通过运行pdftk xyz.pdf output xyz2.pdf来规范化 PDF,这确实解决了问题——但仅适用于某些 PDF 文件,这些文件pdftk修复的文件与未修复的文件之间没有明显的关系。 There are always some files normalized with pdftk that continue to exhibit the exact same error as the unnormalized file.总是有一些使用pdftk规范化的文件继续显示与未规范化文件完全相同的错误。

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 .我已经尝试寻找解决这个问题的方法并提出了这个线程: XeLaTeX questions with includegraphics ,这表明可以通过使用-output-driver=xdv2pdf或使用pdf(la)tex来解决问题. Alas, I can't use PdfLaTeX because I need XeLaTeX's unicode support.唉,我不能使用 PdfLaTeX,因为我需要 XeLaTeX 的 unicode 支持。 As well, I'm using Linux so I can't use the Mac-specific xdv2pdf .同样,我使用的是 Linux,所以我不能使用 Mac 特定的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.对于 XeLaTeX 无法加载这些 PDF 的原因以及如何“修复”这些 PDF 的任何想法和意见,我将非常感激。

Kind regards,亲切的问候,

Brian布赖恩

Luatex (successor to Pdftex) also supports Unicode natively. Luatex(Pdftex的前身)也原生支持Unicode。 What happens when you try compiling using lualatex ? 当您尝试使用lualatex编译时会发生什么?

I had the same issue using XeLaTeX on Debian. 我在Debian上使用XeLaTeX时遇到了相同的问题。 PDFs exported from LibreOffice were imported properly, while including scans as PDFs which were created by my printer failed. 从LibreOffice导出的PDF已正确导入,而包括由我的打印机创建的PDF扫描失败。

I could fix this issue by "re-compilig" the PDF with Ghostscript. 我可以通过重新使用Ghostscript修改PDF来解决此问题。 On Linux this would be done with: 在Linux上,这可以通过以下方式完成:

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

(source: https://superuser.com/a/282056 , there's also the Ghostscript command for Windows) (来源: https : //superuser.com/a/282056 ,还有用于Windows的Ghostscript命令)

Importing the "repaired" PDF with XeLaTeX worked fine. 用XeLaTeX导入“已修复”的PDF效果很好。

I was using \\includegraphics{} and struck a similar problem with a pdf (created by printing a file from Excel using Win2pdf). 我当时使用\\ includegraphics {},并遇到了一个类似的pdf问题(通过使用Win2pdf从Excel打印文件创建)。 I opened the pdf with Adobe Reader and saved a copy. 我使用Adobe Reader打开pdf并保存了副本。 The copy was then successfully incorporated using \\includgraphics{} and the xelatex compiler. 然后使用\\ includgraphics {}和xelatex编译器成功合并了该副本。

I had the same error output:我有相同的错误输出:


(/usr/share/texlive/texmf-dist/tex/latex/pdflscape/pdflscape.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/lscape.sty)) [1] [2]
Chapter 1.
[3] [4]
Chapter 2.
[5] [6]
Chapter 3.
[7] [8] [9] [10]
Chapter 4.
[11]
Overfull \hbox (4.64401pt too wide) in paragraph at lines 182--189
[]\TU/Inter(0)/m/n/10 This makes the use of \TU/Inter(0)/m/it/10 CTRL \TU/Inter
(0)/m/n/10 key combinations more ergonomic. 
[12] [13]
Overfull \hbox (2.98775pt too wide) in paragraph at lines 205--212
\TU/Inter(0)/m/n/10 reachable through the OLED menu. Each cell icon corresponds
 
[14] [15] [16]
Chapter 5.
(/usr/share/texlive/texmf-dist/tex/latex/microtype/mt-cmr.cfg)
Overfull \hbox (15.37852pt too wide) in paragraph at lines 251--258
\TU/Inter(0)/m/n/10 for your computer to execute, but also to write programs (s
cripts) 
[17]
xdvipdfmx:fatal: pdf_link_obj(): passed invalid object.

No output PDF file written.

The page in question in my latex also used pdf figures.我的乳胶中有问题的页面也使用了pdf数字。

The problem went away after installing the ghostscript package (I am running Debian).安装 ghostscript 包后问题就消失了(我正在运行 Debian)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM