how to handle different type of box in drawing pdf page
CGRect cropBoxRect = CGPDFPageGetBoxRect(drawPDFPageRef, kCGPDFCropBox);
CGRect mediaBoxRect = CGPDFPageGetBoxRect(drawPDFPageRef, kCGPDFMediaBox);
CGRect effectiveRect = CGRectIntersection(cropBoxRect, mediaBoxRect);
I am using abov开发者_开发技巧e effective rect in drawing.and it creates issue. Thanks in advance.
MediaBox is defines the physical page size, CropBox defines the visible page size. The size of the page you see in any viewer is given by the CropBox. These boxes are defined in terms of lower left and upper right corners [llx lly urx ury]. Usually the CropBox is contained in MediaBox, so the effectiveRect in your code should match the CropBox.
The MediaBox is mandatory, the CropBox is optional and when it is missing, its value matches the MediaBox.
I think iPDFdev answer is correct and we can just use CropBox. Just need to make sure that we consider the offset or origin of the box. Not only the width and height.
精彩评论