We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Create/Render Svg Image and include to Pdf

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?


Something like:

string imageString = “<?xml version="1.0" standalone="no"?>Created with Highstock 5.0.10Primary axisSecondary axisStyling axesSeries 1Series 2012301.22.43.64.80150300450600Highcharts.com”;

Image image = new Image(imageString);
image.FileType = ImageFileType.Svg;

Thanks in advance
David

Hi David,


Thanks for contacting support.

Please use following code snippet. It will add SVG string to the PDF file. I have attached the output file for your reference.

C#

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;

string imageString = “<?xml version=\"1.0\" standalone=\"no\"?><!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN” “http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd”><svg version=“1.1” class=“highcharts-root” style=“font-family:“Lucida Grande”, “Lucida Sans Unicode”, Arial, Helvetica, sans-serif;font-size:12px;” xmlns=“http://www.w3.org/2000/svg” width=“600” height=“400”>Created with Highstock 5.0.10<clipPath id=“highcharts-tpgg1il-1”><rect x=“0” y=“0” width=“460” height=“276” fill=“none”><clipPath id=“highcharts-tpgg1il-2”><rect x=“0” y=“0” width=“460” height=“276” fill=“none”><clipPath id=“highcharts-tpgg1il-3”><rect x=“0” y=“0” width=“460” height=“276” fill=“none”><rect fill="#ffffff" class=“highcharts-background” x=“0” y=“0” width=“600” height=“400” rx=“0” ry=“0”><rect fill=“none” class=“highcharts-plot-background” x=“68” y=“47” width=“460” height=“276”><g class=“highcharts-pane-group”><g class=“highcharts-grid highcharts-xaxis-grid “><path fill=“none” class=“highcharts-grid-line” d=“M 127.5 47 L 127.5 323 M 127.5 47 L 127.5 323” opacity=“1”><path fill=“none” class=“highcharts-grid-line” d=“M 240.5 47 L 240.5 323 M 240.5 47 L 240.5 323” opacity=“1”><path fill=“none” class=“highcharts-grid-line” d=“M 354.5 47 L 354.5 323 M 354.5 47 L 354.5 323” opacity=“1”><path fill=“none” class=“highcharts-grid-line” d=“M 467.5 47 L 467.5 323 M 467.5 47 L 467.5 323” opacity=“1”><g class=“highcharts-grid highcharts-yaxis-grid highcharts-color-0”><path fill=“none” stroke=”#e6e6e6” stroke-width=“1” class=“highcharts-grid-line” d=“M 68 323.5 L 528 323.5” opacity=“1”><path fill=“none” stroke="#e6e6e6" stroke-width=“1” class=“highcharts-grid-line” d=“M 68 254.5 L 528 254.5” opacity=“1”><path fill=“none” stroke="#e6e6e6" stroke-width=“1” class=“highcharts-grid-line” d=“M 68 185.5 L 528 185.5” opacity=“1”><path fill=“none” stroke="#e6e6e6" stroke-width=“1” class=“highcharts-grid-line” d=“M 68 116.5 L 528 116.5” opacity=“1”><path fill=“none” stroke="#e6e6e6" stroke-width=“1” class=“highcharts-grid-line” d=“M 68 46.5 L 528 46.5” opacity=“1”><g class=“highcharts-grid highcharts-yaxis-grid highcharts-color-1”><path fill=“none” stroke="#e6e6e6" stroke-width=“1” class=“highcharts-grid-line” d=“M 68 323.5 L 528 323.5” opacity=“1”><path fill=“none” stroke="#e6e6e6" stroke-width=“1” class=“highcharts-grid-line” d=“M 68 254.5 L 528 254.5” opacity=“1”><path fill=“none” stroke="#e6e6e6" stroke-width=“1” class=“highcharts-grid-line” d=“M 68 185.5 L 528 185.5” opacity=“1”><path fill=“none” stroke="#e6e6e6" stroke-width=“1” class=“highcharts-grid-line” d=“M 68 116.5 L 528 116.5” opacity=“1”><path fill=“none” stroke="#e6e6e6" stroke-width=“1” class=“highcharts-grid-line” d=“M 68 46.5 L 528 46.5” opacity=“1”><rect fill=“none” class=“highcharts-plot-border” x=“68” y=“47” width=“460” height=“276”><g class=“highcharts-axis highcharts-xaxis “><path fill=“none” class=“highcharts-tick” stroke=”#ccd6eb” stroke-width=“1” d=“M 127.5 323 L 127.5 333” opacity=“1”><path fill=“none” class=“highcharts-tick” stroke="#ccd6eb" stroke-width=“1” d=“M 240.5 323 L 240.5 333” opacity=“1”><path fill=“none” class=“highcharts-tick” stroke="#ccd6eb" stroke-width=“1” d=“M 354.5 323 L 354.5 333” opacity=“1”><path fill=“none” class=“highcharts-tick” stroke="#ccd6eb" stroke-width=“1” d=“M 467.5 323 L 467.5 333” opacity=“1”><path fill=“none” class=“highcharts-axis-line” stroke="#ccd6eb" stroke-width=“1” d=“M 68 323.5 L 528 323.5”><g class=“highcharts-axis highcharts-yaxis highcharts-color-0”><text x=“26” text-anchor=“middle” transform=“translate(0,0) rotate(270 26 185)” class=“highcharts-axis-title” style=“color:#666666;fill:#666666;” y=“185”>Primary axis<path fill=“none” class=“highcharts-axis-line” d=“M 68 47 L 68 323”><g class=“highcharts-axis highcharts-yaxis highcharts-color-1”><text x=“574” text-anchor=“middle” transform=“translate(0,0) rotate(90 574 185)” class=“highcharts-axis-title” style=“color:#666666;fill:#666666;” y=“185”>Secondary axis<path fill=“none” class=“highcharts-axis-line” d=“M 528 47 L 528 323”><g class=“highcharts-series-group”><g class=“highcharts-series highcharts-series-0 highcharts-column-series highcharts-color-0 highcharts-tracker” transform=“translate(68,47) scale(1 1)” clip-path=“url(#highcharts-tpgg1il-2)”><rect x=“28.5” y=“219.5” width=“28” height=“57” fill="#7cb5ec" stroke="#ffffff" stroke-width=“1” class=“highcharts-point highcharts-color-0”><rect x=“142.5” y=“104.5” width=“28” height=“172” fill="#7cb5ec" stroke="#ffffff" stroke-width=“1” class=“highcharts-point highcharts-color-0”><rect x=“255.5” y=“161.5” width=“28” height=“115” fill="#7cb5ec" stroke="#ffffff" stroke-width=“1” class=“highcharts-point highcharts-color-0”><rect x=“368.5” y=“46.5” width=“28” height=“230” fill="#7cb5ec" stroke="#ffffff" stroke-width=“1” class=“highcharts-point highcharts-color-0”><g class=“highcharts-markers highcharts-series-0 highcharts-column-series highcharts-color-0 " transform=“translate(68,47) scale(1 1)” clip-path=“none”><g class=“highcharts-series highcharts-series-1 highcharts-column-series highcharts-color-1 highcharts-tracker” transform=“translate(68,47) scale(1 1)” clip-path=“url(#highcharts-tpgg1il-3)”><rect x=“62.5” y=“127.5” width=“28” height=“149” fill=”#434348" stroke="#ffffff" stroke-width=“1” class=“highcharts-point highcharts-color-1”><rect x=“176.5” y=“219.5” width=“28” height=“57” fill="#434348" stroke="#ffffff" stroke-width=“1” class=“highcharts-point highcharts-color-1”><rect x=“289.5” y=“24.5” width=“28” height=“252” fill="#434348" stroke="#ffffff" stroke-width=“1” class=“highcharts-point highcharts-color-1”><rect x=“402.5” y=“174.5” width=“28” height=“102” fill="#434348" stroke="#ffffff" stroke-width=“1” class=“highcharts-point highcharts-color-1”><g class=“highcharts-markers highcharts-series-1 highcharts-column-series highcharts-color-1 " transform=“translate(68,47) scale(1 1)” clip-path=“none”><text x=“300” text-anchor=“middle” class=“highcharts-title” style=“color:#333333;font-size:18px;fill:#333333;” y=“24”>Styling axes<g class=“highcharts-legend” transform=“translate(207,358)”><rect fill=“none” class=“highcharts-legend-box” rx=“0” ry=“0” x=“0” y=“0” width=“186” height=“27” visibility=“visible”><g class=“highcharts-legend-item highcharts-column-series highcharts-color-0 highcharts-series-0” transform=“translate(8,3)”><text x=“21” style=“color:#333333;font-size:12px;font-weight:bold;cursor:pointer;fill:#333333;” text-anchor=“start” y=“15”>Series 1<rect x=“2” y=“4” width=“12” height=“12” fill=”#7cb5ec" rx=“6” ry=“6” class=“highcharts-point”><g class=“highcharts-legend-item highcharts-column-series highcharts-color-1 highcharts-series-1” transform=“translate(103,3)”><text x=“21” y=“15” style=“color:#333333;font-size:12px;font-weight:bold;cursor:pointer;fill:#333333;” text-anchor=“start”>Series 2<rect x=“2” y=“4” width=“12” height=“12” fill="#434348" rx=“6” ry=“6” class=“highcharts-point”><g class="highcharts-axis-labels highcharts-xaxis-labels “><text x=“128.04926108374386” style=“color:#666666;cursor:default;font-size:11px;fill:#666666;” text-anchor=“middle” transform=“translate(0,0)” y=“342” opacity=“1”>0<text x=“241.3497536945813” style=“color:#666666;cursor:default;font-size:11px;fill:#666666;” text-anchor=“middle” transform=“translate(0,0)” y=“342” opacity=“1”>1<text x=“354.6502463054187” style=“color:#666666;cursor:default;font-size:11px;fill:#666666;” text-anchor=“middle” transform=“translate(0,0)” y=“342” opacity=“1”>2<text x=“467.95073891625617” style=“color:#666666;cursor:default;font-size:11px;fill:#666666;” text-anchor=“middle” transform=“translate(0,0)” y=“342” opacity=“1”>3<g class=“highcharts-axis-labels highcharts-yaxis-labels highcharts-color-0”><text x=“53” style=“color:#666666;cursor:default;font-size:11px;fill:#666666;” text-anchor=“end” transform=“translate(0,0)” y=“327” opacity=“1”>0<text x=“53” style=“color:#666666;cursor:default;font-size:11px;fill:#666666;” text-anchor=“end” transform=“translate(0,0)” y=“258” opacity=“1”>1.2<text x=“53” style=“color:#666666;cursor:default;font-size:11px;fill:#666666;” text-anchor=“end” transform=“translate(0,0)” y=“189” opacity=“1”>2.4<text x=“53” style=“color:#666666;cursor:default;font-size:11px;fill:#666666;” text-anchor=“end” transform=“translate(0,0)” y=“120” opacity=“1”>3.6<text x=“53” style=“color:#666666;cursor:default;font-size:11px;fill:#666666;” text-anchor=“end” transform=“translate(0,0)” y=“51” opacity=“1”>4.8<g class=“highcharts-axis-labels highcharts-yaxis-labels highcharts-color-1”><text x=“543” style=“color:#666666;cursor:default;font-size:11px;fill:#666666;” text-anchor=“start” transform=“translate(0,0)” y=“327” opacity=“1”>0<text x=“543” style=“color:#666666;cursor:default;font-size:11px;fill:#666666;” text-anchor=“start” transform=“translate(0,0)” y=“258” opacity=“1”>150<text x=“543” style=“color:#666666;cursor:default;font-size:11px;fill:#666666;” text-anchor=“start” transform=“translate(0,0)” y=“189” opacity=“1”>300<text x=“543” style=“color:#666666;cursor:default;font-size:11px;fill:#666666;” text-anchor=“start” transform=“translate(0,0)” y=“120” opacity=“1”>450<text x=“543” style=“color:#666666;cursor:default;font-size:11px;fill:#666666;” text-anchor=“start” transform=“translate(0,0)” y=“51” opacity=“1”>600<text x=“590” class=“highcharts-credits” text-anchor=“end” style=“cursor:pointer;color:#999999;font-size:9px;fill:#999999;” y=“395”>Highcharts.com”;
MemoryStream stream = new MemoryStream();
StreamWriter writer = new StreamWriter(stream);
writer.Write(imageString);
writer.Flush();
stream.Position = 0;

Image image = new Image();
image.ImageStream = stream;
image.FileType = ImageFileType.Svg;

page.Paragraphs.Add(txtFragment);
page.Paragraphs.Add(image);
page.Paragraphs.Add(txtFragment);
doc.Save(dataDir + “output.pdf”);

If you still face any issue or need further assistance, please feel free to contact us.

Best Regards,

Hi Fahad,

I am trying to do a similar thing where i have a svg as string and I am tring trying to convert that to an image on the pdf using aspose. While doing so, I am getting a runtime excetpion {Parameters cannot be null} while saving the document. I have a predefined pdf template that I need to add the vector graphics.

Can you please help?

Document pdfDoc = new Document(targetPath);

Page pdfPage = (Page)pdfDoc.Pages[11];

string imageString = “<?xml version=\"1.0\" standalone=\"no\"?><svg version=“1.1” class=“highcharts - root " style=“font - family:” Lucida Grande”, " Lucida Sans Unicode & quot;, Arial, Helvetica, sans - serif; font - size:12px; " xmlns=“http://www.w3.org/2000/svg” width=“1100” height=“400” viewBox=“0 0 1100 400”>Created with Highcharts 5.0.10<clipPath id=“highcharts-hstqml4-1”><rect x=“0” y=“0” width=“900” height=“200” fill=“none”><rect fill=”#ffffff" class=“highcharts-background” x=“0” y=“0” width=“1100” height=“400” rx=“0” ry=“0”><rect fill=“none” class=“highcharts-plot-background” x=“100” y=“100” width=“900” height=“200”><g class=“highcharts-grid highcharts-xaxis-grid “><path fill=“none” class=“highcharts-grid-line” d=“M 151.5 100 L 151.5 300” opacity=“1”><path fill=“none” opacity=“1” class=“highcharts-grid-line” d=“M 593.5 100 L 593.5 300”><path fill=“none” opacity=“1” class=“highcharts-grid-line” d=“M 240.5 100 L 240.5 300”><path fill=“none” opacity=“1” class=“highcharts-grid-line” d=“M 328.5 100 L 328.5 300”><path fill=“none” opacity=“1” class=“highcharts-grid-line” d=“M 416.5 100 L 416.5 300”><path fill=“none” opacity=“1” class=“highcharts-grid-line” d=“M 505.5 100 L 505.5 300”><path fill=“none” opacity=“1” class=“highcharts-grid-line” d=“M 682.5 100 L 682.5 300”><path fill=“none” opacity=“1” class=“highcharts-grid-line” d=“M 770.5 100 L 770.5 300”><path fill=“none” opacity=“1” class=“highcharts-grid-line” d=“M 858.5 100 L 858.5 300”><path fill=“none” opacity=“1” class=“highcharts-grid-line” d=“M 947.5 100 L 947.5 300”><g class=“highcharts-grid highcharts-yaxis-grid “><path fill=“none” stroke=”#e8e8e7” stroke-width=“1” class=“highcharts-grid-line” d=“M 100 300.5 L 1000 300.5” opacity=“1”><path fill=“none” stroke=”#e8e8e7” stroke-width=“1” opacity=“1” class=“highcharts-grid-line” d=“M 100 233.5 L 1000 233.5”><path fill=“none” stroke="#e8e8e7" stroke-width=“1” opacity=“1” class=“highcharts-grid-line” d=“M 100 167.5 L 1000 167.5”><path fill=“none” stroke="#e8e8e7" stroke-width=“1” opacity=“1” class=“highcharts-grid-line” d=“M 100 99.5 L 1000 99.5”><rect fill=“none” class=“highcharts-plot-border” x=“100” y=“100” width=“900” height=“200”><g class=“highcharts-axis highcharts-xaxis “><path fill=“none” class=“highcharts-tick” stroke=”#ccd6eb” stroke-width=“1” d=“M 151.5 300 L 151.5 310” opacity=“1”><path fill=“none” class=“highcharts-tick” stroke="#ccd6eb" stroke-width=“1” d=“M 593.5 300 L 593.5 310” opacity=“1”><path fill=“none” class=“highcharts-tick” stroke="#ccd6eb" stroke-width=“1” d=“M 240.5 300 L 240.5 310” opacity=“1”><path fill=“none” class=“highcharts-tick” stroke="#ccd6eb" stroke-width=“1” d=“M 328.5 300 L 328.5 310” opacity=“1”><path fill=“none” class=“highcharts-tick” stroke="#ccd6eb" stroke-width=“1” d=“M 416.5 300 L 416.5 310” opacity=“1”><path fill=“none” class=“highcharts-tick” stroke="#ccd6eb" stroke-width=“1” d=“M 505.5 300 L 505.5 310” opacity=“1”><path fill=“none” class=“highcharts-tick” stroke="#ccd6eb" stroke-width=“1” d=“M 682.5 300 L 682.5 310” opacity=“1”><path fill=“none” class=“highcharts-tick” stroke="#ccd6eb" stroke-width=“1” d=“M 770.5 300 L 770.5 310” opacity=“1”><path fill=“none” class=“highcharts-tick” stroke="#ccd6eb" stroke-width=“1” d=“M 858.5 300 L 858.5 310” opacity=“1”><path fill=“none” class=“highcharts-tick” stroke="#ccd6eb" stroke-width=“1” d=“M 947.5 300 L 947.5 310” opacity=“1”><path fill=“none” class=“highcharts-axis-line” stroke="#ccd6eb" stroke-width=“1” d=“M 100 300.5 L 1000 300.5”><g class=“highcharts-axis highcharts-yaxis “><path fill=“none” class=“highcharts-axis-line” d=“M 100 100 L 100 300”><g class=“highcharts-series-group”><g class=“highcharts-series highcharts-series-0 highcharts-column-series highcharts-color-0 highcharts-tracker highcharts-series-hover” transform=“translate(100,100) scale(1 1)” clip-path=“url(#highcharts-hstqml4-1)”><rect x=“30.5” y=“117.5” width=“43” height=“83” fill=”#7cb5ec” stroke="#ffffff" stroke-width=“1” class=“highcharts-point highcharts-color-0 “><rect x=“118.5” y=“100.5” width=“43” height=“100” fill=”#7cb5ec” stroke="#ffffff" stroke-width=“1” class=“highcharts-point highcharts-color-0 “><rect x=“207.5” y=“70.5” width=“43” height=“130” fill=”#7cb5ec” stroke="#ffffff" stroke-width=“1” class=“highcharts-point highcharts-color-0 “><rect x=“295.5” y=“50.5” width=“43” height=“150” fill=”#7cb5ec” stroke="#ffffff" stroke-width=“1” class=“highcharts-point highcharts-color-0 “><rect x=“384.5” y=“120.5” width=“43” height=“80” fill=”#7cb5ec” stroke="#ffffff" stroke-width=“1” class=“highcharts-point highcharts-color-0 “><rect x=“472.5” y=“33.5” width=“43” height=“167” fill=“rgb(149,206,255)” stroke=”#ffffff” stroke-width=“1” class=“highcharts-point highcharts-color-0 highcharts-point-hover”><rect x=“560.5” y=“17.5” width=“43” height=“183” fill="#7cb5ec" stroke="#ffffff" stroke-width=“1” class=“highcharts-point highcharts-color-0 “><rect x=“649.5” y=“33.5” width=“43” height=“167” fill=”#7cb5ec” stroke="#ffffff" stroke-width=“1” class=“highcharts-point highcharts-color-0”><rect x=“737.5” y=“17.5” width=“43” height=“183” fill="#7cb5ec" stroke="#ffffff" stroke-width=“1” class=“highcharts-point highcharts-color-0”><rect x=“826.5” y=“50.5” width=“43” height=“150” fill="#7cb5ec" stroke="#ffffff" stroke-width=“1” class=“highcharts-point highcharts-color-0 “><g class=“highcharts-markers highcharts-series-0 highcharts-column-series highcharts-color-0 highcharts-series-hover” transform=“translate(100,100) scale(1 1)” clip-path=“none”><g class=“highcharts-button highcharts-contextbutton” style=“cursor:pointer;” stroke-linecap=“round” transform=“translate(1066,10)”>Chart context menu<rect fill=”#ffffff” class=" highcharts-button-box" x=“0.5” y=“0.5” width=“24” height=“22” rx=“2” ry=“2” stroke=“none” stroke-width=“1”><path fill="#666666" d=“M 6 6.5 L 20 6.5 M 6 11.5 L 20 11.5 M 6 16.5 L 20 16.5” class=“highcharts-button-symbol” stroke="#666666" stroke-width=“3”><text x=“0” style=“font-weight:normal;color:#333333;fill:#333333;” y=“12”><g class=“highcharts-legend” transform=“translate(473,10)”><rect fill=“none” class=“highcharts-legend-box” rx=“0” ry=“0” x=“0” y=“0” width=“154” height=“34” visibility=“visible”><g class=“highcharts-legend-item highcharts-column-series highcharts-color-0 highcharts-series-0” transform=“translate(8,3)”><text x=“21” style=“color:#6f7174;font-size:12px;font-weight:normal;cursor:pointer;font-family:“Frutiger LT W20 57 Cn”;fill:#6f7174;” text-anchor=“start” y=“15”>Estimated Annual Income<rect x=“2” y=“4” width=“12” height=“12” fill="#7cb5ec" rx=“6” ry=“6” class=“highcharts-point”><g class="highcharts-axis-labels highcharts-xaxis-labels "><text x=“152.16110019646365” style=“color:#1a65b9;cursor:default;font-size:11px;fill:#1a65b9;” text-anchor=“middle” transform=“translate(0,0)” y=“319” opacity=“1”>0<text x=“594.2043222003929” style=“color:#1a65b9;cursor:default;font-size:11px;fill:#1a65b9;” text-anchor=“middle” transform=“translate(0,0)” y=“319” opacity=“1”>5<text x=“240.56974459724952” style=“color:#1a65b9;cursor:default;font-size:11px;fill:#1a65b9;” text-anchor=“middle” transform=“translate(0,0)” y=“319” opacity=“1”>1<text x=“328.97838899803537” style=“color:#1a65b9;cursor:default;font-size:11px;fill:#1a65b9;” text-anchor=“middle” transform=“translate(0,0)” y=“319” opacity=“1”>2<text x=“417.38703339882125” style=“color:#1a65b9;cursor:default;font-size:11px;fill:#1a65b9;” text-anchor=“middle” transform=“translate(0,0)” y=“319” opacity=“1”>3<text x=“505.7956777996071” style=“color:#1a65b9;cursor:default;font-size:11px;fill:#1a65b9;” text-anchor=“middle” transform=“translate(0,0)” y=“319” opacity=“1”>4<text x=“682.6129666011788” style=“color:#1a65b9;cursor:default;font-size:11px;fill:#1a65b9;” text-anchor=“middle” transform=“translate(0,0)” y=“319” opacity=“1”>6<text x=“771.0216110019646” style=“color:#1a65b9;cursor:default;font-size:11px;fill:#1a65b9;” text-anchor=“middle” transform=“translate(0,0)” y=“319” opacity=“1”>7<text x=“859.4302554027505” style=“color:#1a65b9;cursor:default;font-size:11px;fill:#1a65b9;” text-anchor=“middle” transform=“translate(0,0)” y=“319” opacity=“1”>8<text x=“947.8388998035364” style=“color:#1a65b9;cursor:default;font-size:11px;fill:#1a65b9;” text-anchor=“middle” transform=“translate(0,0)” y=“319” opacity=“1”>9<g class="highcharts-axis-labels highcharts-yaxis-labels “><text x=“85” style=“color:#1a65b9;cursor:default;font-size:11px;fill:#1a65b9;” text-anchor=“end” transform=“translate(0,0)” y=“304” opacity=“1”>0.0$<text x=“85” style=“color:#1a65b9;cursor:default;font-size:11px;fill:#1a65b9;” text-anchor=“end” transform=“translate(0,0)” y=“237” opacity=“1”>20000.0$<text x=“85” style=“color:#1a65b9;cursor:default;font-size:11px;fill:#1a65b9;” text-anchor=“end” transform=“translate(0,0)” y=“171” opacity=“1”>40000.0$<text x=“85” style=“color:#1a65b9;cursor:default;font-size:11px;fill:#1a65b9;” text-anchor=“end” transform=“translate(0,0)” y=“104” opacity=“1”>60000.0$<g class=“highcharts-label highcharts-tooltip highcharts-color-0” style=“cursor:default;pointer-events:none;white-space:nowrap;” transform=“translate(529,33)” opacity=“1” visibility=“visible”><path fill=“white” class=“highcharts-label-box highcharts-tooltip-box” d=“M 3.5 0.5 L 88.5 0.5 C 91.5 0.5 91.5 0.5 91.5 3.5 L 91.5 31.5 C 91.5 34.5 91.5 34.5 88.5 34.5 L 70.5 34.5 64.5 40.5 58.5 34.5 3.5 34.5 C 0.5 34.5 0.5 34.5 0.5 31.5 L 0.5 3.5 C 0.5 0.5 0.5 0.5 3.5 0.5” stroke=“rgba(215,215,215,.8)” stroke-width=“1”>”;
MemoryStream stream = new MemoryStream();
StreamWriter writer = new StreamWriter(stream);
writer.Write(imageString);
writer.Flush();
stream.Position = 0;


// Set margins so image will fit, etc.
pdfPage.PageInfo.Margin.Bottom = 0;
pdfPage.PageInfo.Margin.Top = 0;
pdfPage.PageInfo.Margin.Left = 0;
pdfPage.PageInfo.Margin.Right = 0;


Aspose.Pdf.Image image = new Aspose.Pdf.Image();
image.ImageStream = stream;

pdfPage.Paragraphs.Add(image);

pdfDoc.Save(targetPath, SaveFormat.Pdf);

Hi David,


Thanks for using our API’s.

I have tested the scenario and have managed to reproduce same problem. For the sake of correction, I have logged it as PDFNET-42642 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

The issues you have found earlier (filed as PDFNET-42642) have been fixed in Aspose.PDF for .NET 18.11.