Hello Syncfusion team,
My angular app uses Syncfusion's EJ2 diagram control. Since the diagram contains native nodes and custom image nodes, I'm forced to use HTMLtoPDFConvert's Webkit rendering (hosted in an asp.net web API) to print/export the diagram.
I extract the diagram's HTML as a string (using the diagram's GetDiagramContent() method), which I then pass on to my back-end asp.net core webAPI.
However, I'm unable to figure out how to call HTMLtoPdfConverter's ConvertPartialHtmltoSvg() methods, in order to create an SVG image.
What should be the value of the 'htmlElementID' parameter?
|
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
WebKitConverterSettings settings = new WebKitConverterSettings();
settings.WebKitViewPort = new Syncfusion.Drawing.Size(1280,0);
//Set WebKit path
settings.WebKitPath = @"C:\Users\xxxxx\.nuget\packages\syncfusion.htmltopdfconverter.qtwebkit.net.core\19.2.0.44\lib\QtBinariesWindows";
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings;
if (File.Exists("Sample.svg"))
{
File.Delete("Sample.svg");
}
MemoryStream stream = new MemoryStream();
htmlConverter.ConvertToSvg("chart.html", stream);
File.WriteAllBytes("Sample.svg", stream.ToArray()); |
|
MemoryStream stream = new MemoryStream();
File.WriteAllBytes("Sample.svg", stream.ToArray()); |
Hi Gowthamraj,
I'm still a bit confused about the exact process for generating the SVG. Here is what I'm trying to do.
Thanks,
-Mithun
|
We can convert partial HTML to SVG using HTML element ID, please refer below code snippet and HTML file for more information. But we are facing issue while converting partial HTML to SVG conversion, currently we are analysing on this and we will update further details by July 21, 2021.
|
As we said earlier, currently we are analysing on this and we will update further details by July 22, 2021.
| |
|
I'm still a bit confused about the exact process for generating the SVG. Here is what I'm trying to do.
|
We do not have support for converting HTML string to SVG with HTML to PDF converter. As a workaround you can write the HTML string to file in sample level and then you can convert the HTML file to SVG using ConvertToSvg method.
|
Thanks Sivaram, that worked! I'm now able to export my diagrams to SVG format.