Wrestled with this for a couple of hours and just can't figure out how PDFlib works. I have this image that we'll say has the size of 1000 x 300 pixels:
Now I want to place a part of the image into a box of 20 x 12 millimeters (at 300 dpi). The resizing must be such that if no cropping were done the image would take up 70 x 21 mm on the page. 3 mm of the image must be cropped away from the top, and 2 mm cropped away from the left side.
The examples and documentation are too weak for me to understand exactly how the parameters for fit_image()
work. How do I accomplish this?
Note: I'm doing this in PHP but I guess the main concern is what parameters PDFlib needs, which is language independent.