pdf - Pandoc Markdown 到 PDF 和 SVG 图像导致“xdvipdfmx:fatal: pdf_link_obj(): pass invalid object.”?
问题描述
考虑以下 Markdown 文档notes.md
:
# Notes
Here some notes about including **SVG** remotely:
I have found this image:
[![Dodecahedron_schlegel](https://upload.wikimedia.org/wikipedia/commons/b/b1/Dodecahedron_schlegel.svg)](https://upload.wikimedia.org/wikipedia/commons/b/b1/Dodecahedron_schlegel.svg)
... and I'd like to have in included in the PDF via `pandoc` ...
<!-- [![RS](https://upload.wikimedia.org/wikipedia/commons/f/f2/RS-485_waveform.svg)](https://upload.wikimedia.org/wikipedia/commons/f/f2/RS-485_waveform.svg) -->
如果我尝试通过pandoc
with将其编译为 PDF xelatex
:
pandoc notes.md --pdf-engine=xelatex -o notes.pdf
一切都很好,没有错误,并且图像在 pdf 中可见:
现在,如果我取消注释第二行 - 这也是来自 wikimedia.org 的 SVG 图像的链接 - 我尝试编译,我会收到大量错误,并且没有生成(新)PDF(完整日志在这里) :
$ pandoc notes.md --pdf-engine=xelatex -o notes.pdf
xdvipdfmx:fatal: pdf_link_obj(): passed invalid object.
No output PDF file written.
xdvipdfmx:fatal: pdf_link_obj(): passed invalid object.
No output PDF file written.
Error producing PDF.
This is XeTeX, Version 3.14159265-2.6-0.999992 (TeX Live 2020/W32TeX) (preloaded format=xelatex 2020.7.9) 7 DEC 2020 09:21
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**C://msys64/tmp/tex2pdf.-b632e90b0d54cf19/input.tex
(C:/msys64/tmp/tex2pdf.-b632e90b0d54cf19/input.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-06-18>
(C:/bin/texlive/2020/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(C:/bin/texlive/2020/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2019/12/20 v1.4l Standard LaTeX file (size option)
)
\c@part=\count163
...
Package fontspec Info: latinmodern-math scale = 0.9998964600422715.
Package fontspec Info: Font family 'latinmodern-math.otf(3)' created for font
(fontspec) 'latinmodern-math.otf' with options
(fontspec) [Scale=MatchLowercase,BoldItalicFont={},ItalicFont={},Sm
allCapsFont={},Script=Math,SizeFeatures={{Size=8.5-},{Size=6-8.5,Font=latinmode
rn-math.otf,Style=MathScript},{Size=-6,Font=latinmodern-math.otf,Style=MathScri
ptScript}},BoldFont={latinmodern-math.otf},ScaleAgain=0.9999,FontAdjustment={\f
ontdimen
(fontspec) 8\font =0.4pt\relax \fontdimen 9\font =2.0pt\relax
(fontspec) \fontdimen 10\font =1.67pt\relax \fontdimen 11\font
(fontspec) =1.11pt\relax \fontdimen 12\font =6.0pt\relax
(fontspec) \fontdimen 13\font =0pt\relax }].
(fontspec)
(fontspec) This font family consists of the following NFSS
(fontspec) series/shapes:
(fontspec)
(fontspec) - 'normal' (m/n) with NFSS spec.:
(fontspec) <8.5->s*[0.9998964600422715]"[latinmodern-math.otf]/OT:s
cript=math;language=dflt;"<6-8.5>s*[0.9998964600422715]"[latinmodern-math.otf]/
OT:script=math;language=dflt;+ssty=0;"<-6>s*[0.9998964600422715]"[latinmodern-m
ath.otf]/OT:script=math;language=dflt;+ssty=1;"
(fontspec) - 'small caps' (m/sc) with NFSS spec.:
(fontspec) and font adjustment code:
(fontspec) \fontdimen 8\font =0.4pt\relax \fontdimen 9\font
(fontspec) =2.0pt\relax \fontdimen 10\font =1.67pt\relax
(fontspec) \fontdimen 11\font =1.11pt\relax \fontdimen 12\font
(fontspec) =6.0pt\relax \fontdimen 13\font =0pt\relax
(fontspec) - 'bold' (b/n) with NFSS spec.:
(fontspec) <->s*[0.9998964600422715]"[latinmodern-math.otf]/OT:scri
pt=math;language=dflt;"
(fontspec) - 'bold small caps' (b/sc) with NFSS spec.:
(fontspec) and font adjustment code:
(fontspec) \fontdimen 8\font =0.4pt\relax \fontdimen 9\font
(fontspec) =2.0pt\relax \fontdimen 10\font =1.67pt\relax
(fontspec) \fontdimen 11\font =1.11pt\relax \fontdimen 12\font
(fontspec) =6.0pt\relax \fontdimen 13\font =0pt\relax
LaTeX Font Info: Encoding `OMX' has changed to `TU' for symbol font
(Font) `largesymbols' in the math version `normal' on input line 6
3.
LaTeX Font Info: Overwriting symbol font `largesymbols' in version `normal'
(Font) OMX/lmex/m/n --> TU/latinmodern-math.otf(3)/m/n on inpu
t line 63.
LaTeX Font Info: Encoding `OMX' has changed to `TU' for symbol font
(Font) `largesymbols' in the math version `bold' on input line 63.
LaTeX Font Info: Overwriting symbol font `largesymbols' in version `bold'
(Font) OMX/lmex/m/n --> TU/latinmodern-math.otf(3)/b/n on inpu
t line 63.
\AtBeginShipoutBox=\box49
Package hyperref Info: Link coloring OFF on input line 63.
(C:/bin/texlive/2020/texmf-dist/tex/latex/hyperref/nameref.sty
Package: nameref 2019/09/16 v2.46 Cross-referencing by name of section
(C:/bin/texlive/2020/texmf-dist/tex/latex/refcount/refcount.sty
Package: refcount 2019/12/15 v3.6 Data extraction from label references (HO)
)
(C:/bin/texlive/2020/texmf-dist/tex/generic/gettitlestring/gettitlestring.sty
Package: gettitlestring 2019/12/15 v1.6 Cleanup title references (HO)
)
\c@section@level=\count283
)
LaTeX Info: Redefining \ref on input line 63.
LaTeX Info: Redefining \pageref on input line 63.
LaTeX Info: Redefining \nameref on input line 63.
File: C://msys64/tmp/tex2pdf.-b632e90b0d54cf19/ce60773d6c257b0c33bde80c372cc790
8f36edaa.pdf Graphic file (type pdf)
<use C://msys64/tmp/tex2pdf.-b632e90b0d54cf19/ce60773d6c257b0c33bde80c372cc7908
f36edaa.pdf>
File: C://msys64/tmp/tex2pdf.-b632e90b0d54cf19/5977a217a848816000aa43663baa452f
be03f979.pdf Graphic file (type pdf)
<use C://msys64/tmp/tex2pdf.-b632e90b0d54cf19/5977a217a848816000aa43663baa452fb
e03f979.pdf>
Package atveryend Info: Empty hook `BeforeClearDocument' on input line 79.
[1
]
Package atveryend Info: Empty hook `AfterLastShipout' on input line 79.
(C:\/msys64/tmp/tex2pdf.-b632e90b0d54cf19/input.aux)
Package atveryend Info: Empty hook `AtVeryEndDocument' on input line 79.
Package atveryend Info: Empty hook `AtEndAfterFileList' on input line 79.
Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 79.
)
Here is how much of TeX's memory you useC:
16163 strings out of 480251
288174 string characters out of 5899096
720292 words of memory out of 5000000
33615 multiletter control sequences out of 15000+600000
532998 words of font info for 34 fonts, out of 8000000 for 9000
622 hyphenation exceptions out of 8191
53i,5n,118p,343b,316s stack positions out of 5000i,500n,10000p,200000b,80000s
Error 1 (driver return code) generating output;
file C:\/msys64/tmp/tex2pdf.-b632e90b0d54cf19/input.pdf may not be valid.
有谁知道我该如何解决这个问题 - 所以我也可以使用 pandoc 在 PDF 中包含其他图像?
解决方案
我有相同的错误输出:
(/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.
我的乳胶中有问题的页面也使用了pdf数字。
安装 ghostscript 包后问题就消失了(我正在运行 Debian)。
推荐阅读
- sql - 如何在 SQL 的列中的 json blob 中添加新键
- python - 在 pandas 中查找局部最小值
- python-3.x - IntegrityError Django ORM
- date - 如何使用 DateFormat 类将 DateTime 对象格式化为带有字母 h 的字符串,例如 13h45?
- javascript - 内容更改后 JavaScript 停止执行 - Laravel Livewire
- javascript - 尝试访问数组元素返回 TypeError: data.list is not defined
- c - 结构中的指针和结构中 typedef 的使用
- swift - 我们如何实现像 iOS 14 AppLibrary 这样的模糊效果?(SearchBar 后面的模糊效果)
- node.js - 无法让 node-google-spreadsheet 在 Corvid Wix 中工作
- java - 在这种情况下我将如何重置实例变量?我是java新手,如果这是一个简单的答案,请原谅我