Printing Pdf using AirPrint causes cut-off content
- by Jatin Patel
Here i am printing pdf with size 'pageSize = CGSizeMake(640, 832);'. this size is larget then A4 size page aspected. so i will cut-off some text(means it will not print whole page).
while printing same pdf using MAC, it will print whole page with help of option (scale to fit). so can any one help me to come out from this problem.. is there any option in IOS sdk for scale to fit.
here is my code..
-(void)printItem
{
NSArray *aArrPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) ;
NSString *aStr = [[aArrPaths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"PropertyReport_%d.pdf",self.propertyId]];
// NSString *aStr = [[NSBundle mainBundle] pathForResource:@"TRADUZIONE HELP SECTIONS REV2" ofType:@"pdf"];
NSURL *url=[[NSURL alloc] initFileURLWithPath:aStr];
NSData *data=[[NSData alloc] initWithContentsOfURL:url];
printController = [UIPrintInteractionController sharedPrintController];
if(printController && [UIPrintInteractionController canPrintData:data])
{
printController.delegate = self;
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
//printInfo.jobName = [NSString stringWithFormat:@"New Image"];
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 %u", error.domain, error.code);
}
};
// aWebViewPDF.hidden=FALSE;
[printController presentAnimated:YES completionHandler:completionHandler];
}
}
Thanks
Jatin Patel