Forum How do I...?

How do I control image sizing?

cletus
I have a PDF that I'm generating on A4 (portrait) that is roughly 650 pixels wide (taking up nearly the whole page). As an aside:how is the pixel ratio worked out?

Anyway, I have an image that is 342px wide. It should take up over 50% of the width of the page on current scales. It does on an HTML view but when I print it with Prince it shrinks quite a bit to the point where it's less than a third of the page width.

How is this controlled? Why is the image using a different scaling to the rest of the page?
mikeday
Probably the image has an intrinsic resolution (DPI) that is different to the normal DPI assumed by Prince (96dpi). You can override this using the prince-image-resolution property.
cletus
How do I use/apply this property via the PHP interface?

Cheers
mikeday
You need to add it to your CSS. One way of doing this is to create a style sheet file, eg. style.css, and add the desired rules there:
img { prince-image-resolution: normal }

Then use prince->addStylesheet before calling convert.
cletus
Thanks Mike, that works great.

I didn't see that mentioned anywhere in the documentation however.

Did I just miss it?
mikeday
No, I think we missed it. :)