I'm trying to print a PDF from my UIWebView
, but the output PDF does not fill the A4 format. Why? How do I resolve that?
Any help will be greatly appreciated =)
If found the solution by avoid printing form IUWebView
. I directly download the PDF in NSData format.
_data represente the NSData that i download by a request.
if (_data) {
UIPrintInteractionController *printController = [UIPrintInteractionController sharedPrintController];
printController.delegate = self;
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
//printInfo.jobName = [path lastPathComponent];
printInfo.duplex = UIPrintInfoDuplexLongEdge;
printController.printInfo = printInfo;
printController.showsPageRange = YES;
printController.printingItem = _data;
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
if (!completed && error) {
NSLog(@"FAILED! due to error in domain %@ with error code %lu", error.domain, (long)error.code);
}
};
[printController presentAnimated:YES completionHandler:completionHandler];
}