In Firefox, images floating outside of containers and page margins
I have been struggling with a problem with <img>
tags using Firefox (via Selenium) to generate PDF output. I finally found a solution that works, but I thought I would post the issue anyway so that it might be fixed in the future and so anyone else with the same problem can find this info about the workaround.
An image rendered using an <img>
tag stubbornly refuses to stay within the horizontal margins and instead, extends from its left starting position to the right edge of the page, beyond the right margin.
What finally worked for me was to set object-fit
to scale-down
and also max-width
to 100%
in the tag's style. None of the other things that should usually be expected to work helped at all.