dalibo / pandocker

🐳 A simple docker image for pandoc with filters, templates, fonts, and the latex bazaar
https://hub.docker.com/r/dalibo/pandocker/
BSD 3-Clause "New" or "Revised" License
145 stars 23 forks source link

Image resizing in markdown to pdf? #270

Closed DigiDuckArnold closed 5 months ago

DigiDuckArnold commented 1 year ago

I do have some images which are displayed in my pdf document as a very small image, like a post stamp/thumbnail. The pdf is generated from a markdown document

I use command:

docker run --rm -u `id -u`:`id -g` -v `pwd`:/pandoc:Z dalibo/pandocker:23.03 -V geometry:margin=2cm inputfile.md -o outputfile.pdf
           -s --toc -f markdown-smart --template eisvogel --listings --number-sections --pdf-engine xelatex --toc-depth=6 -V block-headings

In my markdown file I use:

![file-subtitle](./folder/to_file.png){ height=200px }

As inspired by https://superuser.com/questions/796565/correctly-sizing-png-images-in-markdown-with-pandoc-for-html-pdf-docx

But I do get error message: " Error producing PDF. ! LaTeX Error: Can be used only in preamble."

Ho to set the size of my image in markdown to pdf conversion?

daamien commented 1 year ago

Hi !

Thanks for your interest in this project, however I believe this issue is not specific to the pandocker image but rather a more general problem of the eisvogel template or even the pandoc project itself

to debug your issue, you should try to generate the latex output ( rename outputfile.pdf to outputfile.latex ) and search for the to_file.png line

Also try to generate your PDF without eisvogel and see if the error still happens. If so, it may be a pandoc bug.

https://github.com/Wandmalfarbe/pandoc-latex-template https://github.com/jgm/pandoc/issues