Hi
I’m trying to include a svg image to a pdf Page. That works fine if i have the svg file saved on my server (Example below).
string chartDir = “C:\Temp\”;
Document doc = new Document();
Page page = doc.Pages.Add();
TextFragment txtFragment = new TextFragment(“Lorem ipsum…”);
txtFragment.Margin = new MarginInfo(10, 20, 10, 20);
txtFragment.TextState.ForegroundColor = Color.BlueViolet;
txtFragment.TextState.FontSize = 20;
txtFragment.TextState.FontStyle = FontStyles.Bold;
txtFragment.TextState.FontStyle = FontStyles.Italic;
Image image = new Image();
image.File = chartDir + “chart.svg”;
image.FileType = ImageFileType.Svg;
page.Paragraphs.Add(txtFragment);
page.Paragraphs.Add(image);
page.Paragraphs.Add(txtFragment);
return doc;
Well, I have a service which returns the svg content as a string. Is there a way to create and add the image to the pdf without saving a svg file on the server?
Something like:
string imageString =“<?xml version="1.0" standalone="no"?>Created with Highstock 5.0.10<clip…nslate(0,0)” y=“120” opacity=“1”>450600Highcharts.com";
Image image = new Image(imageString);
image.FileType = ImageFileType.Svg;
Thanks in advance
David