Questions tagged [uiprintpagerenderer]

A UIPrintPageRenderer object draws pages of content that are to be printed, with or without the assistance of print formatters. Available in iOS 4.2 and later . The issues related with coco touch's UIPrintPageRender should only use this tag.

A page renderer is an instance of a custom subclass of UIPrintPageRenderer. When you compose a print job using the shared instance of UIPrintInteractionController, you assign the page renderer to the printPageRenderer property of that instance.

UIPrintPageRenderer usually requires you to specify the number of pages of printable content by overriding numberOfPages. It also allows you to specify the heights of page headers and footers.

Source: UIPrintPageRenderer Class Reference

Related tag:

38 questions
6
votes
2 answers

iOS8 UIPrintPageRenderer hangs

I'm using BNHtmlPdfKit to render Html to PDF. It worked great but in iOS8 it just hangs on [renderer drawPageAtIndex:i inRect:renderer.paperRect]; To be honest I don't even know how to debug it - theres no error messages and you can keep pressing…
Chris
  • 2,727
  • 2
  • 27
  • 28
5
votes
1 answer

UIPrintPageRenderer / HTML to PDF issue : extra blank space added in rendered PDF

We have an issue using UIPrintPageRenderer while rendering an HTML in UIWebview to PDF page. The HTML contains a table with multiple rows (....) whose heights are known. The UIWebView well renders that HTML but once transformed in PDF through…
momomonet
  • 51
  • 2
4
votes
1 answer

IOS print pdf with minimal margins

This must be quite simple but I can't seem to figure this out. I've managed to implement the code for printing an PDF from my App. Problem is, the PDF has quite some whitespace around it and with the default margins... it's just not how I would like…
DIJ
  • 347
  • 4
  • 19
4
votes
0 answers

Print a WebView content on duplex (front and back) printer with different margins for front and back

I have a WebView, and want to print it's HTML content via AirPrint. I want to add custom page margins to this content. I was able to achieve it using my own subclass of UIPrintPageRenderer Now, whenever my app user is using duplex printer (printing…
4
votes
1 answer

Create PDF from UIWebView

I'm having problem creating PDF from UIWebView. let render = UIPrintPageRenderer(); /* 1. pdf from webView */ render.addPrintFormatter(webView.viewPrintFormatter(), startingAtPageAtIndex: 0); // 2. Assign…
lam fan
  • 51
  • 1
  • 4
3
votes
3 answers

Drawing horizontal line in printed pdf using UIPrintPageRenderer

I'm using UIPrintPageRenderer sub-class to print html content on a pdf. How can i add a horizontal line on my printed content (both on header and footer)? CGContextAddLineToPoint doesn't seem to work in UIPrintPageRenderer methods. Specifically…
Mustafa
  • 20,504
  • 42
  • 146
  • 209
3
votes
3 answers

Using One or More Formatters with a Page Renderer in iOS

Has anyone tried using multiple formatters (UIViewPrintFormatter, UIMarkupTextPrintFormatter, UISimpleTextPrintFormatter) with a page renderer (UIPrintPageRenderer) to print the content? I'm trying to use two UIMarkupTextPrintFormatters with a…
Mustafa
  • 20,504
  • 42
  • 146
  • 209
3
votes
1 answer

UIPrintPageRenderer how to switch between US-Letter and DIN-A4 format

I tried to implement a custom PDF-Renderer, inherited from UIPrintPageRenderer. My problem ist that the output-size of the PDF is 215,9 x 279,4 mm. But the correct DIN A4 dimensions i need are 210 x 297 mm. Obviously im getting the size of a…
Joel
  • 396
  • 1
  • 15
3
votes
0 answers

Printing HTML String in WKWebView Fails to Print Large PDFs

Swift 4, Xcode 9.2, iOS 11 I generate an HTML string that represents a bunch of data displayed in a WKWebView like this: //I include this so I can reference some images let bundle = Bundle.main.bundlePath //Load the…
Clifton Labrum
  • 13,053
  • 9
  • 65
  • 128
2
votes
1 answer

How to get accurate pageCount from a UIPrintFormatter

I'm using a UIMarkupTextPrintFormatter to print some HTML from my app. It works great if I let the print formatter print to the entire page. But I want to limit the formatter to printing on one half of the page - and to accomplish this I set the…
TomSwift
  • 39,369
  • 12
  • 121
  • 149
2
votes
1 answer

Setting pages to be printed for UIPrintPageRenderer / UIPrintInteractionController

I have an HTML string to be printed using AirPrint in my iOS app. However, the string is customisable and the user is allowed to set margin/paddings, font/font size, orientation etc. Thus, sometimes the output can be more than 2 pages where the…
kubilay
  • 5,047
  • 7
  • 48
  • 66
2
votes
1 answer

UIPrintInteractionController appends a blank page when the orientation is set to Landscape

I'm trying to send a string to the printer using UIMarkupTextPrintFormatter and everything is allright when I don't change the page orientation -which is set to portrait by default. However, when I set the page orientation to landscape, one blank…
2
votes
0 answers

UIWebViewPrintFormatter leaves increasing blank space at bottom of header as html content increases in height

I have a custom UIPrintPageRender that utilises html to generate a pdf report. What I'm finding is that the final rendered html doesn't consume the calculated height I pass as the pageRender's contentHeight leaving a blank space between the header…
Steve
  • 21
  • 3
2
votes
3 answers

UIPrintInteractionController not printing to full page in iPhone

I am printing a pdf from iPhone to Airprint compatible printer using Apple print document example. But I am not getting full page print from iPhone, please see the picture of what I am getting, I need the pdf to be printed on full paper…
1
vote
1 answer

AirPrint HTML file made locally iPhone

I am currently creating a html file and storing it locally, i give the user the choice of sending the html by HTML or print. For some reason it is failing to print. if i test - if([UIPrintInteractionController canPrintData:myData]){ it…
Dan
  • 1,447
  • 2
  • 14
  • 30
1
2 3