title: Rendering a UIView into a PDF as vectors on an iPad - Sometimes renders as bitmap, sometimes as vectors
body: <p>I have an iPad app and I'm trying to generate a PDF from a UIView and it's <em>almost</em> working perfectly.</p>
  
  <p>The code is really simple as follows:</p>
  
  <pre><code>UIGraphicsBeginPDFContextToFile( filename, bounds, nil );
  UIGraphicsBeginPDFPage();
  CGContextRef pdfContext = UIGraphicsGetCurrentContext();
  [view.layer renderInContext:pdfContext];
  UIGraphicsEndPDFContext();
  </code></pre>
  
  <p>This works really well with one weird exception. If the view has been on screen before being rendered to PDF then the UILabels on the view are rendered to the PDF as wonderful vectors. If the view has not yet been on the screen (IE the controller was initWithNib etc but hasn't been pushed into a navigation controller or anything) then the text is rendered as a bitmap at 'ipad' resolution.</p>
  
  <p>It's like the act of getting rendered to the screen sets up the view to be rendered as vectors when I subsequently render it to a pdf context. </p>
  
  <p>Is there some method I can call or property I can set on the view or the layer or elsewhere to mimic this behaviour without having to show the view on screen?</p>
  
  <p>Is it something to do with UIViewPrintFormatter?</p>