Hi,
We need to extract charts from Excel sheet and convert them to PDF format as a vector graphic.
We used Aspose.Cells (for .NET) to extract chart from Excel sheet and convert it to EMF. Then we used Aspose.PDF (for .NET) to convert it to PDF, but our chart became raster graphic.
Here is our code:
class Program {static void Main(string[] args) {var workbook = new Aspose.Cells.Workbook(“c:/temp/book2.xlsx”);var chart = workbook.Worksheets[0].Charts[0];chart.ToImage(“c:/temp/test.emf”, System.Drawing.Imaging.ImageFormat.Emf);var pdf1 = new Aspose.Pdf.Generator.Pdf();var sec = pdf1.Sections.Add();var fs = System.IO.File.OpenRead(“c:/temp/test.emf”);byte[] data = new byte[fs.Length];fs.Read(data, 0, data.Length);var ms = new System.IO.MemoryStream(data);var imageht = new Aspose.Pdf.Generator.Image(sec) {ImageInfo = {ImageFileType = Aspose.Pdf.Generator.ImageFileType.Emf,ImageStream = ms},VectorGraphicsRenderingDPI = 140};sec.Paragraphs.Add(imageht);pdf1.Save(“c:/temp/test.pdf”);ms.Close();}}
Do you have any solutions for our problem?
We will also appreciate for some code example.
<o:p></o:p>