An image can be added for use with pdf in two ways:
- Let dompdf determine the size for the image acoording to the DOMPDF_DPI setting in dompdf_config.inc.php or
- Determine the size in CSS using a unit other than pixels
Method 1: place your image in your html doc and change the line following line to your preferred DPI setting:
Note: This gives you little control over the width/height of the image used in your pdf. (Keeping in mind that you might want to do this dynamically and let users upload their own images)
Method 2: set the image size in your CSS, ie:
This gives the image (with class name ‘fixedsize’) a fixed width of 150mm. Very usefull to stay ‘true’ to a certain layout.
Note: The disadvantage of this method is that an image can be too small to decently use in your predefined size and thus appears grainy in your pdf file.
All in all this works fine and I ran into no trouble at all.