I am using php and fpdf to generate a pdf. How can I scale a 400 pixel high image to fit in a 300 point high space? The dimensions are just examples, the image and available space are dynamic.

Edit
Report