I am printing out a UIImage
using AirPrint but the margins aren't correct. This is what it looks like when it prints:
Is there a way I can make it fit perfectly on the paper?
Here's the code as requested:
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
//pic.delegate = del;
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.jobName = [NSString stringWithFormat:@"New Ticket"];
pic.printInfo = printInfo;
pic.printingItem = [UIImage imageWithContentsOfFile:path];
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) =
^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
if (!completed && error) {
UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Error."
message:[NSString stringWithFormat:@"An error occured while printing: %@", error]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
[av show];
[av release];
}
};
[pic presentAnimated:YES completionHandler:completionHandler];
UIImage
, why aren't you settingprintInfo.outputType
toUIPrintInfoOutputPhoto
instead ofUIPrintInfoOutputGeneral
? – Insignificance