开发者

how to handle different type of box in drawing pdf page

开发者 https://www.devze.com 2023-02-15 14:17 出处:网络
How to handle different type of Pdf display boxes like media box, cropbox etc.. I am drawing pdf and page\'s cropbox and media box are different so page is cutting. So any one have a clear idea how t

How to handle different type of Pdf display boxes like media box, cropbox etc.. I am drawing pdf and page's cropbox and media box are different so page is cutting. So any one have a clear idea how to take care or handle about this boxes while drawing a 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消