Ajax chart not rendering in Pdf Using pechkin asp.net c#

780 Views Asked by At

i have been using Pechkin (wkhtml wrapper for c#) to create pdf reports in my project and its working fine except i cant render any ajax chart(pie, bar, bubble or anything) in my created pdf, i have also tried rederdelay property but it didnt help me a bit.

the text data comes but the chart doesnt and the whole thing mess up. So i deduced that the problem is because created charts are not using standard html for the wrapper to handle, so in conclusion i need something which can convert these chart to images before html render on fly and it should be OpenSource/free.

thanks Alok

P.S. I am using ajax control toolkit charts, pechkin is latest install from nuGet.

1

There are 1 best solutions below

2
On

convert the chart into image and use this function to convert into byte array

 private Byte[] Chart()
 {
   using (var chartimage = new MemoryStream())
   {
      chart.SaveImage(chartimage, ChartImageFormat.Png);
      return chartimage.GetBuffer();
   }
 }

then create image from those byte[]

 var image = Image.GetInstance(Chart());
 image.ScalePercent(75f);

add this image in the document