I have some diagrams in the extjs4application toolbar. I want to create a pdf report using the images of these diagrams for this I use iTextSharp
Is there a way to get images from charts to include them in my report?
The ideal for me is to use it like this: itextsharp
MyImageStream = new MemoryStream(); myChart.SaveImage(MyImageStream);
my chart will be a chart object
I asked in the forums where they told me that I will generate and display my diagram on the client (already done), and then I will get svg, send it to the server, and the server will use it to generate pdf ... but I I don’t know how to work with svg nor how to send it to the server
EDIT
im trying to use wkhtmltoimage to save my chart to image
but it doesn’t work when I specify mapPath for my .aspx
but it works fine if I provide the website url or localhost (see htem in the comment)
does not work, I mean the lack of error, but not created png!
my code is:
var url = HttpContext.Current.Server.MapPath("~/chartImage.aspx");//dosnt work //works : // "google.com"; //"localhost/chartImage.aspx";// var fileName = " pie13.png "; var wkhtmlDir = HttpContext.Current.Server.MapPath("~/wkhtmltopdf/pdf/");//"C:\\Program Files\\wkhtmltopdf\\"; var wkhtml = HttpContext.Current.Server.MapPath("~/wkhtmltopdf/wkhtmltoimage.exe");//"C:\\Program Files\\wkhtmltopdf\\wkhtmltopdf.exe"; var p = new Process(); p.StartInfo.CreateNoWindow = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.RedirectStandardInput = true; p.StartInfo.UseShellExecute = false; p.StartInfo.FileName = wkhtml; p.StartInfo.WorkingDirectory = wkhtmlDir; string switches = ""; //switches += "--print-media-type "; //switches += "--margin-top 10mm --margin-bottom 10mm --margin-right 10mm --margin-left 10mm "; //switches += "--page-size Letter "; p.StartInfo.Arguments = switches + " " + url + " " + fileName; p.Start();
early
source share