title: Creating a simple XFinium PDF on iOS containing an image
body: <p>We're using XFinium on our C# Xamarin Forms app on iOS.  I had some test code that would create a PDF with a couple of pieces of text and it worked correctly.  However, when I tried to include an image, the resulting PDF doesn't contain the image and Acrobat Reader gives the "An error exists on this page".  The image in question is a resource in my application (not loaded from URL).</p>
  
  <pre><code>string path = Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData);
  string file = System.IO.Path.Combine(path, "report.pdf");
  PdfFixedDocument document = new PdfFixedDocument();
  PdfStandardFont helveticaBold = new PdfStandardFont(PdfStandardFontFace.HelveticaBold, 16);
  PdfPage page = document.Pages.Add();
  page.Width = 8 * 72 + 36;
  page.Height = 11 * 72;
  PdfBrush blackBrush = new PdfBrush(PdfRgbColor.Black);
  page.Graphics.DrawString("Hello", helveticaBold, blackBrush, 20, 50);
  string imageFileName = "UI_Assets_Image.png";
  FileStream imageStream = System.IO.File.Open(imageFileName, FileMode.Open, FileAccess.Read, FileShare.Read);
  PdfPngImage image = new PdfPngImage(imageStream);
  Debug.WriteLine("   image is " + image.Width + " x " + image.Height);
  // Reports 1373 x 417 which is correct so I believe it is
  // loading the image correctly
  // Draw image in the page width
  PdfSize size = page.Graphics.DrawImage(image, 36, 75, 540, 166);
  Debug.WriteLine("   DrawImage() returned " + size.Width + " x " + size.Height);
  // Reports 540 x 166 which seems reasonable
  using (FileStream stream = System.IO.File.Create(file))
  {
      document.Save(stream, null);
  }
  </code></pre>
  
  <p>If I don't include the image, the PDF is fine.</p>