title: How may I get the image of DataVisualization.Charting.Chart to iTextSharp.text.Image without writing to a file?
body: <p>I'm writing a piece of software for visualization of measurement data. For this I use System.Windows.Forms.DataVisualization.Charting.Chart and I do know that I can get the shown image by chartObj.SaveImage to store it to a file.</p>
  
  <p>My software shall have a PDF export in which the picture should be included. For this, I'm using iTextSharp. Again, I do know how to put a picture which I have stored in a file into the PDF by iTextSharp.text.Image.GetInstance.</p>
  
  <p>So by now I am able to take the picture of the chart, put it to a file (e.g. a .jpg file) and load this file again to put it in my PDF. Now I'm looking for a nice solution to get the picture into the PDF without storing it into a file, maybe through a Stream or something like that. I've tried quite some time, but until now I didn't succeed. I've thought of something like</p>
  
  <pre><code>Stream imageStream = image of chartObj;
  iTextSharp.text.Image picture = iTextSharp.text.Image.GetInstance(imageStream);
  </code></pre>
  
  <p>As far as I understand, I fail in putting the picture from the chartObj into a Stream instead of a file. If I had this, I guess I could load the Stream via iTextSharp.text.Image.GetInstance.</p>
  
  <p>Has anyone some help you could offer? Guess it's not that difficult, but I'm new to C# and also to iText, so I'm just a bit stucked here.</p>
  
  <p>Thanks in advance for every thought you have about this!</p>
  
  <p>Anna</p>