wesbos
wesbos

Reputation: 26307

Pandoc markdown to PDF

I'm looking to convert my Markdown book to a PDF.

I've done a lot of research and it seems that Pandoc is the best choice for this. It seems pandoc converts the markdown to latex and then to a PDF.

The problem I am running into is including external images. Ideally I would have the process grab the remote images off the net and put them into the pdf.

I'm hitting this error:

pandoc: Error producing PDF from TeX source.
! Package pdftex.def Error: File `http://wes.io/QYGG/content.png' not found.

See the pdftex.def package documentation for explanation.
Type  H <return>  for immediate help.
 ...

l.84 ...degraphics{http://wes.io/QYGG/content.png}

I have MacTex installed and the command I'm running is pandoc test.md -o test.pdf

I've never used latex before, so I'm a bit at a loss of how to fix this.

Upvotes: 4

Views: 3797

Answers (2)

mb21
mb21

Reputation: 39179

Newer versions of pandoc fetch external images before passing them on to LaTeX.

Alternatively, you could use ConTeXt instead of LaTeX which natively supports fetching images from URLs:

$ pandoc -t context test.md -o test.pdf

Upvotes: 3

David Alan Hjelle
David Alan Hjelle

Reputation: 952

According to this LaTex question, you can't directly reference URL images from within LaTeX, though they have a potential LaTeX-hacking option available at the link.

Local image files are probably your best bet.

Upvotes: 4

Related Questions