title: iOS - Getting warning and not able to print
body: <p>I'm using iOS 5.0.1 to develop an app.
  I'm using the following code to print the screen shot of the view in my ipad app:</p>
  
  <pre><code>CGRect rect = CGRectMake(0, 0, 768, 1004);
  UIGraphicsBeginImageContext(rect.size);
  CGContextRef context = UIGraphicsGetCurrentContext();
  [self.view.layer renderInContext:context];
  UIImage *img = UIGraphicsGetImageFromCurrentImageContext();       
  UIGraphicsEndImageContext();
  
  UIPrintInteractionController* pic = [UIPrintInteractionController sharedPrintController];
  NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(img)];
  if (pic &amp;&amp; [UIPrintInteractionController canPrintData:imageData])
      {
          pic.delegate = self;
          UIPrintInfo* printInfo = [UIPrintInfo printInfo];
          printInfo.outputType = UIPrintInfoOutputPhoto;
          printInfo.jobName = @"PrintingImage";
          printInfo.duplex = UIPrintInfoDuplexLongEdge;
          pic.printInfo = printInfo;
          pic.showsPageRange = YES;
          pic.printingItem = imageData;
  
          void (^completionHandler) (UIPrintInteractionController *, BOOL, NSError*) = ^(UIPrintInteractionController *pic, BOOL completed, NSError* error) {
              if (!completed &amp;&amp; error) {
                  NSLog(@"Error: %@", error.localizedDescription);
              }  
          };
  
          [pic presentAnimated:YES completionHandler:completionHandler];
      }
  </code></pre>
  
  <p>Its not showing the printing view and throwing following error:</p>
  
  <pre><code>WARNING: Calling -[UIPrintInteractionController presentAnimated:completionHandler:] on iPad
  failed to find PDF header: `%PDF' not found.
  failed to find PDF header: `%PDF' not found.
  failed to find PDF header: `%PDF' not found.
  failed to find PDF header: `%PDF' not found.
  </code></pre>