title: How can I display a PDF full screen on an iPad?
body: <p>I have attached the code snippet that I am using for displaying a PDF. The following code displays the PDF, but it seems that it is either squeezed or not using the full size of the iPad display, resulting in a page that is too small.</p>
  
  <p>How can I display a PDF that fits in the boundary of an iPad display or in a zoomed state? I have tried using a different approach (approach-2), but it creates a problem with the PDF appearing rotated at a 90-degree angle.</p>
  
  <p>Approach-1:</p>
  
  <pre><code>CGContextSaveGState(ctx);
  
  CGContextTranslateCTM(ctx, 0.0, [self.view bounds].size.height);
  CGContextScaleCTM(ctx, 1.0, -1.0);
  CGContextConcatCTM(ctx, 
                     CGPDFPageGetDrawingTransform(page, kCGPDFCropBox, 
                                                  [self.view bounds], 0, true));
  
  CGContextDrawPDFPage(ctx, page);    
  CGContextRestoreGState(ctx);
  </code></pre>
  
  <p>Approach-2:</p>
  
  <pre><code>CGPDFPageRef page = CGPDFDocumentGetPage(pdfdocument, PageNo+1);
  if(page){
      CFRetain(page);
  }
  CGRect pageRect =CGPDFPageGetBoxRect(page, kCGPDFMediaBox);
  int angle= CGPDFPageGetRotationAngle(page);
  float pdfScale = self.bounds.size.width/pageRect.size.width;
  CGContextSetRGBFillColor(context, 1.0,1.0,1.0,1.0);
  CGContextFillRect(context,self.bounds);
  CGContextSaveGState(context);
  // Flip the context so that the PDF page is rendered
  // right side up.
  CGContextTranslateCTM(context, 0.0, self.bounds.size.height);
  CGContextScaleCTM(context, 1.0, -1.0);
  
  // Scale the context so that the PDF page is rendered 
  // at the correct size for the zoom level.
  CGContextScaleCTM(context, pdfScale,pdfScale);  
  CGContextDrawPDFPage(context, page);
  CGContextRestoreGState(context);
  </code></pre>
  
  <p>Can anyone suggest to me a solution that allows any PDF of any size and any angle to be displayed full screen on an iPad in both orientations? It would be great if you can provide me a code snippet or pseudo-code.
  Thanks</p>