将 PDF 文件导入 XeLaTeX 会给出“pdf_link_obj():传递的无效对象”错误
我正在尝试使用 \includepdf{xyz.pdf}
将 PDF 导入到 XeLaTeX 中。文件 xyz.pdf
是由 Xerox 5755 机器创建的扫描件,PDF 版本为 1.3。
我得到的错误是:
** 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.
我尝试通过运行 pdftk xyz.pdf output xyz2.pdf
来规范化 PDF,并且确实解决了问题 - 但仅限于某些 PDF文件,pdftk
修复的文件和未修复的文件之间没有明显的关系。总有一些使用 pdftk
标准化的文件继续表现出与未标准化文件完全相同的错误。
我尝试寻找此问题的解决方案并提出此线程: XeLaTeX 与 includegraphics 的问题,这表明该问题可以通过使用 -output-driver=xdv2pdf
或使用 pdf( la)tex
。唉,我不能使用 PdfLaTeX,因为我需要 XeLaTeX 的 unicode 支持。另外,我使用的是 Linux,因此无法使用 Mac 专用的 xdv2pdf
。
对于 XeLaTeX 为何无法加载这些 PDF 的任何想法和意见,以及(更好的是)如何“修复”这些 PDF,我将非常感激。
亲切的问候,
布莱恩
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Luatex(Pdftex 的后继者)本身也支持 Unicode。当您尝试使用
lualatex
进行编译时会发生什么?Luatex (successor to Pdftex) also supports Unicode natively. What happens when you try compiling using
lualatex
?我在 Debian 上使用 XeLaTeX 时遇到了同样的问题。从 LibreOffice 导出的 PDF 已正确导入,但将由我的打印机创建的扫描件包含为 PDF 却失败。
我可以通过使用 Ghostscript“重新编译”PDF 来解决此问题。
在 Linux 上,这可以通过以下方式完成:(
来源:https://superuser.com/a/282056,还有 Ghostscript 命令对于 Windows)
使用 XeLaTeX 导入“修复”的 PDF 效果很好。
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:
(source: https://superuser.com/a/282056, there's also the Ghostscript command for Windows)
Importing the "repaired" PDF with XeLaTeX worked fine.
我使用 \includegraphics{} 并在 pdf 中遇到了类似的问题(通过使用 Win2pdf 从 Excel 打印文件创建)。我用 Adobe Reader 打开了 pdf 并保存了一份副本。然后使用 \includgraphics{} 和 xelatex 编译器成功合并该副本。
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.