简体   繁体   English

Pandoc Markdown to PDF, and SVG image causing "xdvipdfmx:fatal: pdf_link_obj(): passed invalid object."?

[英]Pandoc Markdown to PDF, and SVG image causing "xdvipdfmx:fatal: pdf_link_obj(): passed invalid object."?

Consider the following Markdown document, notes.md :考虑以下 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) -->

If I try to compile this to PDF via pandoc with xelatex :如果我尝试使用xelatex通过pandoc将其编译为 PDF :

pandoc notes.md --pdf-engine=xelatex -o notes.pdf

everything is fine, no errors, and image is visible in the pdf:一切都很好,没有错误,并且图像在 pdf 中可见:

pandoc-to-pdf-OK

Now, if I uncomment the second line - which also is a link to an SVG image from wikimedia.org - and I try to compile, I get a massive number of errors, and no (new) PDF produced (full log is here ):现在,如果我取消注释第二行 - 这也是来自 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.

Does anyone have an idea how I could fix this - so I could also include that other image in the PDF using pandoc?有谁知道我该如何解决这个问题 - 所以我还可以使用 pandoc 在 PDF 中包含其他图像?

I had the same error output:我有同样的错误 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.我的 latex 中的相关页面也使用了 pdf 数字。

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

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

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