We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Convert Diagram SVG to EPS or EMF

We are looking to convert a the SVG from a ASP.NET MVC Diagram to EMF or EPS so that we can include it in a PDF or office documents in a vector format.
This needs to be a server side solution (for report creation).

We have a PNG version of this working via using phantomJS to extract the SVG and take a screenshot to create the PNG.

Our attempts however to convert a SVG Diagram to vector based EMF or EPS using various methods such as the c# SVG Rendering Library and Inkscape have failed.
None of these approaches appear to be able to correct read in the SVG Diagram, although they do work with simple sample SVGs.
Even online conversion tools such as https://cloudconvert.org/svg-to-emf to not seem to be able correctly read the SVGs generated in the ASP.NET MVC Diagrams.

Can you please advise if you are planning to deliver this conversion capability in Essential Studio in the near future, or if not whether there is a 3rd party solution you can advise for this.

 Ed


5 Replies

SG Shyam G Syncfusion Team October 15, 2014 01:20 PM UTC

Hi Ed,

Thanks for using syncfusion products.

We are glad to inform you that we have created a console application in which command is executed that saves SVG onto the server. We have provided a link below to convert SVG into EPS.

Link: http://www.office-converter.com/SVG-to-EPS

Note: we have commented the line that performs interaction in generated SVG. To perform an interaction in SVG, please uncomment the lines in “Serialization.js”  file as given below

  var diagram = $find("Serialization");

  var nodeConn = JSON.stringify({ nodes: diagram._Nodes, connector: diagram._Connectors });

  var nc = document.createElement("svg");

  nc.setAttributeNS('http://www.w3.org/2000/svg', 'xmlns', 'http://www.w3.org/2000/svg');

  nc.style.display = "none";

  nc.setAttribute("id", "nodesandconnectors");

  nc.innerHTML = nodeConn;

  html.appendChild(nc);

Please let me know if any concerns.

Regards,

Shyam G


Attachment: phantomjsconsoleapplication_3e2c4b6e.zip


EG Ed Guest October 15, 2014 03:38 PM UTC

Hi Sharam,

This is exactly how we have been doing it (other that using different utilities to run the conversion).

With our more complex diagrams however none of the tools - including your suggested http://www.office-converter.com/SVG-to-EPS will convert the SVG correctly.
I have attached some samples for you reference.
The SVG is that extracted from the diagram.
The PNG is taken using PhantomJS to take a screenshot.

The EPS and EMF are attempts to convert the SVG. I cannot find any tools other than web browsers that can correctly render this SVG generated by the ASP.NET MVC diagram.
I would also like to stress we do need a server side solution (such as inkscape), rather than one using a web service for the conversion.

Kind Regards,

 Ed

Attachment: DiagramTest_6ed6d790.zip


SG Shyam G Syncfusion Team October 16, 2014 01:12 PM UTC

Hi Ed,

Thanks for the update.

We are working on your requirement of converting SVG to EPS or EMF in server side. Could you please ensure whether your requirement is to convert PNG to EPS,EMF or SVG to EPS,EMF, so that we can analyze and provide a better solution to you.

Please let me know if any concerns.

Regards,

Shyam G.



EG Ed Guest October 17, 2014 08:37 AM UTC

Our requirement is to convert from the SVG to EMF (or EPS, but EMF is our preference).
This needs to be vector based, not a raster images embedded in the EMF.

Thanks,

 Ed


SG Shyam G Syncfusion Team October 18, 2014 01:57 AM UTC

Hi Ed,

Thanks for the update.

We have used inkscape to convert SVG to EMF or EPS, we could not make the output as expected. Currently we don’t have support to convert SVG to EMF or EPS. We consider this to be a feature request. Currently we don’t have any plan to implement this feature and will implement this in any one of our upcoming releases.

Please let me know if any concerns.

Regards,

Shyam G


Loader.
Live Chat Icon For mobile
Up arrow icon