Pandoc: Deal with missing images.

Created on 31 Aug 2016  ·  6Comments  ·  Source: jgm/pandoc

Command:

pandoc -s --latex-engine=xelatex https://www.xyplorer.com/whatsnew.php -o file.pdf

Output:

pandoc: Could not find image `img/xyplorer-32.png', skipping...
! Unable to load picture or PDF file 'img/xyplorer-32.png'.
<to be read again> 
                   }
l.67 ...in,height=0.33333in]{img/xyplorer-32.png}}

pandoc: Error producing PDF

What is the suggested way to deal with such issues? Currently, instead of generating a pdf, I generate a latex, and then manually edit that file to remove such missing images from the source and then use xelatex to convert that .tex to pdf.

I understand that there's not much pandoc can do in cases like these, but perhaps there could be a switch which would really _skip_ the images by also removing them from the .tex source.

Most helpful comment

Nonetheless I agree. When pandoc can't find the image for formats like PDF, it should replace the broken image link with something else: a span. I'm going to implement this.

All 6 comments

IMO, This case is quite similar to the encoding errors one which throws up errors like:

! Package inputenc Error: Unicode char 最 (U+6700)
(inputenc)                not set up for use with LaTeX.

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

l.1848   最

Try running pandoc with --latex-engine=xelatex.
pandoc: Error producing PDF

And pandoc suggests that running with xelatex might fix things. Something similar for missing images will be nice too!

Pandoc has this very nice feature called filters. It is perfect for cases like yours and makes it easy to handle such things programmatically. I'd recommend to check it out.

@tarleb Thanks. I'll check them out, and see if I can hack something together.

I still feel that this would be a nice feature addition for the core itself.

Funny, when I tried it pandoc found the image with no problems. Are you perhaps using an older version of pandoc?

Nonetheless I agree. When pandoc can't find the image for formats like PDF, it should replace the broken image link with something else: a span. I'm going to implement this.

@jgm I'm currently on a different machine which has pandoc 1.17.2 and yes, it works. I'm glad you understood the feature request though. 👍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

graymalkin picture graymalkin  ·  54Comments

jclement picture jclement  ·  117Comments

jgm picture jgm  ·  51Comments

jgm picture jgm  ·  62Comments

stepht picture stepht  ·  54Comments