zhaoterryy / mkdocs-pdf-export-plugin

An MkDocs plugin to export content pages as PDF files
MIT License
313 stars 44 forks source link

Image size behavior different in PDF vs HTML #33

Closed estan closed 5 years ago

estan commented 5 years ago

This may be more of a Weasyprint/CSS issue, but:

image_sizes

Note how the images in the HTML (left) are not scaled up to fit the page width, but in the PDF (right) they are.

It seems the behavior in the HTML is: Scale down pictures if they are too large for the page width (but never scale up).

While the behavior in the PDF output is: Always scale the picture to fit the page width.

Is it possible to get the PDF to have the same behavior as in the HTML?

estan commented 5 years ago

Nevermind, I figured out it was not a matter of difference in behavior, img { image-resolution: 300dpi; } fixed the issue:

result