MobileSheets Forums

Full Version: Internals: Crop values
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When a song page from a (possibly larger) PDF is cropped, this is registered in the database table Crop.
I was wondering what the exact interpretation of the values for Left/Top/Right/Bottom is.
I'd like to use these values for an external tool to apply the same crop to the pages.
That's interesting. Maybe these coordinates can be exported and used for another import by csv? Kind of saving the crop data without a full backup?
They are the coordinates relative to the file page dimensions. So to use them, you will need to open the file and read the size of the page.
This is what I thought, but the numbers just do not match.
For example, in one of my PDFs all pages have the same dimensions (mediabox 597.0 x 828.0). In the Crop table I see typical values of 596 and occasionally 598 (right) and 824 and 827 (bottom).

For page dimensions, do you use MediaBox, CropBox, BleedBox, TrimBox or ArtBox?
(07-05-2017, 05:27 AM)BRX Wrote: [ -> ]That's interesting. Maybe these coordinates can be exported and used for another import by csv? Kind of saving the crop data without a full backup?

Exactly  Smile
I use the MediaBox for the page dimensions. i believe I am setting the right value of the crop rectangle to pageWidth - 1 and the bottom value to pageHeight - 1 if you drag the cropping boxes all the way to the edges of the page. If you clear the cropping, I set it to 0,0,0,0, so that's how you can identify when no crop has been applied. During some of my processing, if I calculate that cropping was applied, I set pageWidth = width of the cropping box + 1, and pageHeight = height of the cropping box + 1, and verify that I haven't exceeded the raw page dimensions (otherwise I clamp).