13

要在 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);

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

4

1 回答 1

39

PDF 和 PostScript 使用“PostScript 点数”作为单位。PostScript 点为 1/72 英寸。所以默认的页面大小是

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

这是美国信纸尺寸。

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

于 2012-08-04T14:29:32.227 回答