0
Я начинаю xcode, и я хотел распечатать с помощью Air Print для моего объективного приложения C. Вот код, который у меня есть.Воздух Печать изображений объектив c
-(IBAction)Print {
UIImage *image = [UIImage imageNamed:@"picTwizzlerfw.png"];
NSMutableString *printBody = [NSMutableString stringWithFormat:@"%@",_TextField.text];
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
//pic.delegate = self;
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.jobName = @"PrintJob";
pic.printInfo = printInfo;
UISimpleTextPrintFormatter *textFormatter = [[UISimpleTextPrintFormatter alloc] initWithText:printBody];
textFormatter.startPage = 0;
textFormatter.contentInsets = UIEdgeInsetsMake(72.0, 72.0, 72.0, 72.0);
textFormatter.maximumContentWidth = 6 * 72.0;
pic.printFormatter = textFormatter;
pic.showsPageRange = YES;
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
if (!completed && error) {
NSLog(@"Printing could not complete because of error: %@", error);
}
};
[pic presentAnimated:YES completionHandler:completionHandler];
}
Сейчас он печатает TextField
, но я хочу, чтобы напечатать image
. Если бы кто-нибудь мог помочь, это было бы здорово!
Почему бы не использовать 'UIActivityViewController' с изображением? Затем пользователь может выбрать то, что они хотят сделать с изображением, включая печать. – rmaddy