title: iTextSharp: C# image to PDF - Spread big asp chart on more than one page
body: <p>I have a very tall asp chart(PNG file), let's say 4000px in height. When the pdf file is generated using iTextSharp, it has only one page and i can see only 25-30% of my chart. I don't want to scale the image to fit into one page. I want to spread/split my chart on multiple pages so I can see the chart's details. If my chart fits into four pages, the PDF also needs to have four pages.
  In the image bellow you can see my chart, how I want it (spread on 6 pages), and how it actualy looks generated by iTextSharp (the top of the chart displayed on one single page).
  <a href="https://www.dropbox.com/s/bccsb80hit9qaoi/itextsharp.JPG" rel="nofollow">Image</a></p>
  
  <pre><code>    Document pdfDoc = new Document(PageSize.A4.Rotate(), 10f, 10f, 10f, 0f);
      PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
      pdfDoc.Open();
      using (MemoryStream stream = new MemoryStream())
      {
          Chart1.SaveImage(stream, ChartImageFormat.Png);
          iTextSharp.text.Image chartImage = iTextSharp.text.Image.GetInstance(stream.GetBuffer());
          chartImage.ScalePercent(70f);// This solves the width of the chart
          pdfDoc.Add(chartImage);
          pdfDoc.Close();
  
          Response.ContentType = "application/pdf";
          Response.AddHeader("content-disposition", "attachment;filename=Chart.pdf");
          Response.Cache.SetCacheability(HttpCacheability.NoCache);
          Response.Write(pdfDoc);
          Response.End();
      }
  </code></pre>