iOS上PDF文档的默认纸张大小和单位

mcy*_*mcy 12 pdf-generation objective-c ios

要在iOS中创建PDF文档,请参阅官方文档(http://developer.apple.com/library/ios/#documentation/2DDrawing/Conceptual/DrawingPrintingiOS/GeneratingPDF/GeneratingPDF.html#//apple_ref/doc/uid/TP40010156 -CH10-SW3),默认大小为612x792,比率为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);
Run Code Online (Sandbox Code Playgroud)

但是,国际标准IS0216的A4纸的默认尺寸为210x297mm,其纵横比为1.41429.所以,我的问题是:Apple标准的单位是什么?这个612x792尺寸与A4相同吗?是否包括打印边距等?

Mar*_*n R 36

PDF和PostScript使用"PostScript点"作为一个单元.PostScript点是1/72英寸.所以默认的页面大小是

612 x 792 points = 8.5 x 11 inch = 215.9 mm x 279.4 mm
Run Code Online (Sandbox Code Playgroud)

这是美国信纸尺寸.

边界矩形UIGraphicsBeginPDFPageWithInfo()定义了PDF页面的所谓"媒体框".媒体框是应在其上打印页面的媒体大小,因此包括边距.

  • 一定要将标准的36点边距至少添加到可打印区域.将612x792设置为纸张尺寸,并从可能的可打印区域中减去72. (4认同)