Images cut off in PDF

27 August, 2024 03:06:19
mindfulwp
Topics: 2
Messages: 8
Hi, when I generate a PDF from a blog post, I noticed that the any images seem to get cut off in the PDF because they are too large.

For example, if the image is set to 1024px width, then it gets cut off. But if I manually change the image width to 600px then it will appear fine in the PDF.

Is there a setting somewhere to have images automatically "fit" the width of the PDF document? It would be helpful otherwise I have to manually go through all the images in all my blog posts and resize the images to 600px which is tedious.

Thanks!
27 August, 2024 03:20:22
E2Pdf
Support
Topics: 7
Messages: 3345
Hello,

You should be able to modify the "image" size via the CSS section. Images by default will be cut off if they are not fit by height. So you can change the width or set for example auto width but define the height:

width: auto;
height: 100px;

Unfortunately, max-width / max-height isn't yet supported. We are working on the new HTML worker, which should be available next month and it should have support for current settings.
We would really appreciate your feedback at WordPress.org!
27 August, 2024 03:29:23
mindfulwp
Topics: 2
Messages: 8
The problem is with the images that are being pulled in from the blog content area using the shortcode.

I tried adding different kinds of CSS but it doesn't seem to do anything. See here: https://markuphero.com/share/vS4tIVq8GLNpxvtYFpzR
27 August, 2024 03:32:14
E2Pdf
Support
Topics: 7
Messages: 3345
It can be that the image is still too large in height after setting the width to 600px and overflows the "HTML" object.

Can you please try to add CSS as follows:

img {
width: 50px;
height: auto;
}

or

img {
width: auto;
height: 50px;
}

We would really appreciate your feedback at WordPress.org!
27 August, 2024 03:37:02
mindfulwp
Topics: 2
Messages: 8
It seems that the CSS doesn't get applied at all to the images. Here is what I added: https://markuphero.com/share/rZcWZ7mKHrZOuDgavTe7 -- But the images are still being rendered at full size in the PDF.
27 August, 2024 03:44:29
E2Pdf
Support
Topics: 7
Messages: 3345
Can you please place the [e2pdf-download] shortcode on some page, so we can see the PDF render?

P.S. Keep also the "HTML Worker 2.0" option turned on the HTML Worker 2.0, as we see that it's not checked.
We would really appreciate your feedback at WordPress.org!
27 August, 2024 03:58:08
mindfulwp
Topics: 2
Messages: 8
Please disregard my request! It turns out I've been editing the wrong plugin this whole time. I feel so silly. My apologies.