26
3
I am trying to use markdown with pandoc to convert a single document into html, pdf, and docx. It's an extremely simple document containing only math-less text and a few images. The images are in PNG format. I include an image using this in markdown source:
<div style="float:center" markdown="1">
![my caption](./figures/myimage.png)
</div>
and compile it as:
# html
pandoc myarticle.md -c mystyle.css -o myarticle.html
# pdf
pandoc myarticle.md -V geometry:margin=1in -o myarticle.pdf
# docx
pandoc myarticle.md -o myarticle.docx
I noticed that some PNG images that have the same dimensions get sized differently in HTML and PDF formats. A PNG that is 250x256 px with low resolution (72 px/in) will appear in PDF as the correct size roughly on page, and appear in a reasonable size in html, but a PNG that has the same dimensions (250x256 px) but is high-res (300 px/in) get resized to be tiny on the page in the PDF output. I want to keep on set of PNG images in a size that I specify and have them appear in that size in both the HTML/PDF/DOCX formats.
I am willing to give up automatic docx support (or deal with a lot of manual formatting after) just to have PDF/HTML.
How can I tell pandoc not to resize PNGs for PDF or image, and have them appear in their correct images? thanks.
2A PNG that is 300dpi but only 250x256px should be quite small on the page, shouldn't it? (Less than one inch square.) A PNG with a lower dpi will be bigger on the page. Pandoc takes into account dpi information, as well as pixel size, in sizing the images. And shouldn't it? Perhaps you could use CSS to globally scale down the high-res images in HTML. – John MacFarlane – 2014-08-14T00:33:14.567
1@JohnMacFarlane: I see that pandoc's behavior is correct in taking dpi into account - but I want it to ignore dpi and stick with absolute sizes, so that I can keep a single high res PNG for all images. Is the correct way to do this to make lower resolution version of the images, or is there a way to make pandoc simply only use the dimensions of image and ignore resolution? That would be simplest from my end – user46976 – 2014-08-14T19:24:11.330