objective-cairprintuiprintinteractioncntrler

ios - Font issue while Printing HTML using AirPrint


I am printing HTML page using air print. Here is my Code

UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.jobName = @"Print";
printInfo.outputType = UIPrintInfoOutputGeneral;

UIPrintInteractionController *printController = [UIPrintInteractionController sharedPrintController];
printController.showsPageRange = NO;
printController.printInfo = printInfo;

UIMarkupTextPrintFormatter *formatter = [[UIMarkupTextPrintFormatter alloc] initWithMarkupText:_PrintHTMLText];
printController.printFormatter = formatter;

Everything is printing fine. But only i get the problem of changed font and the printed text.

I tried printing same HTML through Web but it is printing right. But as i try from device the font changes by its own.

What i need to do to solve this problem?


Solution

  • It solved when i added

    formatter.contentInsets = UIEdgeInsetsMake(0, 20, 0, 20);