c# - How to save a MS Chart in WMF format and insert in the PDF iTextSharp -
i've been working in asp.net mvc application (c#) in visual studio 2012. i've created several reports ms charts (to show them in pdf file i've used itextsharp). but, charts have bad quality when they're zoomed on 200%. because of save charts in wmf format (i found itextsharp doesn't support svg format). save chart in wmf format i've used next code:
using (var chartimage = new memorystream()) { chartcentersbyyear.saveimage(chartimage, chartimageformat.png); using (var imagesys = system.drawing.image.fromstream(chartimage)) { var image = itextsharp.text.image.getinstance(imagesys, system.drawing.imaging.imageformat.wmf); image.scalepercent(50f); image.setabsoluteposition(document.leftmargin + 40, document.bottommargin + 95); document.add(image); } }
but i've received error in line:
var image = itextsharp.text.image.getinstance(imagesys, system.drawing.imaging.imageformat.wmf);
the error is:"value cannot null. parameter name: encoder". how can save chart in wmf format? thank in advance help.
Comments
Post a Comment