Default paper size and unit for PDF documents on iOS

允我心安 提交于 2019-12-03 09:16:37

问题


For creating PDF documents in iOS, in the official documentation (http://developer.apple.com/library/ios/#documentation/2DDrawing/Conceptual/DrawingPrintingiOS/GeneratingPDF/GeneratingPDF.html#//apple_ref/doc/uid/TP40010156-CH10-SW3), the default size is given as 612x792, which has a ratio of 1.29412.

// Create the PDF context using the default page size of 612 x 792.
UIGraphicsBeginPDFContextToFile(pdfFileName, CGRectZero, nil);
CFRange currentRange = CFRangeMake(0, 0);
NSInteger currentPage = 0;
BOOL done = NO;
do {
// Mark the beginning of a new page.
   UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, 612, 792), nil);

However, default size of an A4 paper of international standard IS0216 is 210x297mm, which has an aspect ratio of 1.41429. So, my questions are: What is the unit of Apple's standard? Is this 612x792 dimension identical with A4? Are the printing margins, etc., included?


回答1:


PDF and PostScript use "PostScript points" as a unit. A PostScript point is 1/72 inch. So the default page size is

612 x 792 points = 8.5 x 11 inch = 215.9 mm x 279.4 mm

This is the US Letter paper size.

The bounds rectangle in UIGraphicsBeginPDFPageWithInfo() defines the so-called "media box" of the PDF page. The media box is the size of the medium on which the page should be printed and therefore includes the margins.



来源:https://stackoverflow.com/questions/11809133/default-paper-size-and-unit-for-pdf-documents-on-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!