i am having this code to do the AirPrint the textview text
-(IBAction)_clickbtnprintermainnote:(id)sender
{
UIPrintInteractionController *print = [UIPrintInteractionController sharedPrintController];
print.delegate = self;
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.jobName =@"Nots of MyBibleApp";
printInfo.duplex = UIPrintInfoDuplexLongEdge;
print.printInfo = printInfo;
print.showsPageRange = YES;
print.printingItem = _txtmainnote.text;
void (^completionHandler)(UIPrintInteractionController *,BOOL, NSError *) = ^(UIPrintInteractionController *print,BOOL completed, NSError *error) {
if (!completed && error) {
NSLog(@"houston we have a problem");
}
};
[print presentAnimated:YES completionHandler:completionHandler];
}
but i didn't get any popup for printer option like the default pinter option in iPad.am not using a bar button,i have a UIbutton.how to do this correctly,is there any mistake in my code?._txtmainnote is my textview.
Thanks in advance.
From this, the printingItem
:
The object must be an instance of the
NSURL
,NSData
,UIImage
, orALAsset
class.
so probably you have to pass something like:
NSData* data=[_txtmainnote.text dataUsingEncoding:NSUTF8StringEncoding];
print.printingItem = data;