Question

I am creating an ipad application in which i want to send data to the wifi printer programmatically. Is there any API or sample code available to acheive this?

Thanks.

Was it helpful?

Solution

I think the normal printing APIs will accomplish this, using AirPrint. http://developer.apple.com/library/IOs/documentation/2DDrawing/Conceptual/DrawingPrintingiOS/Printing/Printing.html

In addition, there's a great app called Printopia that allows your Mac to serve as an AirPrint host: http://www.ecamm.com/mac/printopia/

OTHER TIPS

UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];

if (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];
}

}

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top