Free Support Forum -

Converting SVG to HTML (586.0 KB)
We are evaluating various aspose products to convert svg to html.
We attempted this in 2 ways, first using the code:
public void ConvertSvgToHtml( string svgFilename, string htmlFilename )
// Initialize MemoryStream to save intermediary PDF file
MemoryStream stream = new MemoryStream();

	    // Load input SVG file
	    using ( SVGDocument document = new SVGDocument( svgFilename ) )
		    // Specify PdfRenderingOptions
		    PdfRenderingOptions options = new PdfRenderingOptions()
			                                  // Set Page Setup properties
			                                  PageSetup =
				                                  Sizing = SizingType.FitContent
		    using ( PdfDevice device = new PdfDevice( options, stream ) )
			    // Render SVG to PDF file
			    document.RenderTo( device );

	    // Load the PDF document
	    Document pdfDocument = new Document(stream);
	    pdfDocument.PageInfo.IsLandscape = true;

	    // Save SVG file contents to output HTML format
	    pdfDocument.Save( htmlFilename, SaveFormat.Html );

This threw an exception in the line:
Document pdfDocument = new Document(stream); using document drivers-hbt.svg (included in the attached zip, in directory Examples\Data\convert). It was successful on other documents.
The second attempt used the attached solution and worked at converting; however, tags were generated that split words/strings into multiple spans and also “rearranged” or at least put $ into places unexpected. Ideally we would want strings to be kept in one span. There doesn’t seem to any pattern to the spans.
I’ve attached the solution that generated the documents. The resulting files are in the convert subdirectory.


We tested the scenario in our environment and did not notice any Exception. The API generated an output HTML without raising any issue. Could you please make sure that you are using a valid license while evaluating the APIs? Please try to apply for a 30-days free temporary license in order to evaluate the APIs without trial mode restrictions and let us know in case you still notice any issue.