我们如何设置打印尺寸UIPrintInteractionController

时间:2018-10-22 15:30:09

标签: ios objective-c iphone

我要设置A6页面进行打印。我正在使用以下代码进行打印。但是我找不到如何设置pageSize和page formate以使打印效果更好。

void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) =
^(UIPrintInteractionController *pic, BOOL completed, NSError *error) {
    if (!completed && error) NSLog(@"Print error: %@", error);
};

UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.orientation = UIPrintInfoOrientationPortrait;

NSData *pdfData = [self generatePDFDataForPrinting];
printController.printingItem = pdfData;


if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
    [printController presentFromRect:sender.frame inView:self.view
                            animated:YES completionHandler:completionHandler];
} else {
    [printController presentAnimated:YES completionHandler:completionHandler];
}

1 个答案:

答案 0 :(得分:0)