I want to set A6 Page For Print. i'm using below code for print. but i can't find how i set pageSize and page formate that my print look better.
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];
}
You can implement UIPrintInteractionControllerDelegate.printInteractionController:choosePaper:
to return UIPrintPaper.bestPaperForPageSize
or some other desired size.
See also this SO answer .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.