brainite / php-file-converters

Provide unified interface for file conversion.
https://www.brainite.org/php-file-converters
MIT License
24 stars 6 forks source link

Correct PDF to JPG conversion for cropped pages #80

Open stackpr opened 9 years ago

stackpr commented 9 years ago
pdftk schedule.pdf dump_data
...
PageMediaRect: 0 0 1224 792
PageMediaDimensions: 1224 792
PageMediaCropRect: 0 0 610.647 792

By default, convert will respect PageMediaDimensions but will ignore PageMediaCropRect.

This results in a PDF that appears to be portrait actually export as landscape with extra white space (or similar).

Adding the "-page letter" flag to the convert command can address this when the page size is obvious (confirmed), but that is not technically accurate. A better solution would be to extract the crop values and apply them within the convert command using "-crop ...".