Monday, 26 August 2013

Issue while printing selected range of papers using UIPrintInteractionController

Issue while printing selected range of papers using
UIPrintInteractionController

I need to print documents using UIPrintInteractionController below is code
i have been using
UIPrintInteractionController *printController =
[UIPrintInteractionController sharedPrintController];
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.jobName = [filePath lastPathComponent];
printInfo.duplex = UIPrintInfoDuplexLongEdge;
printController.printInfo = printInfo;
printController.showsPageRange = YES;
printController.delegate = self;
NSData *fileData =[NSData dataWithContentsOfURL:localFileURL];
printController.printingItem = fileData;
Printing works fine for PDF file & other documents type but even when i
select page range say Page 1-2 for documents of say 5 pages , it prints
all the 5 pages Printing selected range of pages works fine when i either
set printFormatter & printPageRenderer instead of printingItem
UIPrintPageRenderer *myRenderer = [[UIPrintPageRenderer alloc] init];
// To draw the content of each page, a UIViewPrintFormatter is used.
UIViewPrintFormatter *viewFormatter = [self.documentWebview
viewPrintFormatter];
[myRenderer addPrintFormatter:viewFormatter startingAtPageAtIndex:0];
printController.printPageRenderer = myRenderer;
Here documentWebview is UIWebview where i am loading my local copy of
documents in application document directory But this inserts extra space
for header & footer on each page and causes each page to extend across a
second page of paper Is there any why by which i can remove this headers &
footer space

No comments:

Post a Comment