2012-01-06 19 views

答えて

0

UIPrintInteractionController * PIC = [UIPrintInteractionController sharedPrintController]。

(PIC & & [UIPrintInteractionController canPrintData:self.myPDFData])であれば{

pic.delegate = self; 

UIPrintInfo *printInfo = [UIPrintInfo printInfo]; 

printInfo.outputType = UIPrintInfoOutputGeneral; 

printInfo.jobName = @"PrintPdf"; 

printInfo.duplex = UIPrintInfoDuplexLongEdge; 

pic.printInfo = printInfo; 

pic.showsPageRange = YES; 

pic.printingItem = self.myPDFData; 

void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = 

^(UIPrintInteractionController *pic, BOOL completed, NSError *error) { 

    if (!completed && error) 

     NSLog(@"FAILED! due to error in domain %@ with error code %ld", 

       error.domain, (long)error.code); 
}; 
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { 

    [pic presentFromRect:self.printButton.frame inView:self.view animated:YES completionHandler:^(UIPrintInteractionController *printInteractionController, BOOL completed, NSError *error) { 
    }]; 

} else { 
    [pic presentAnimated:YES completionHandler:completionHandler]; 
} 

}

関連する問題