Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active December 22, 2021 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/ea46e288dae0df3a13f127337bff3eba to your computer and use it in GitHub Desktop.
Save aspose-com-gists/ea46e288dae0df3a13f127337bff3eba to your computer and use it in GitHub Desktop.
Convert SVG to HTML on Linux in C# .NET
// Initialize MemoryStream to save intermediary PDF file
MemoryStream stream = new MemoryStream();
// Load input SVG file
using (Aspose.Svg.SVGDocument document = new SVGDocument("Sample.svg"))
{
// Specify PdfRenderingOptions
PdfRenderingOptions options = new PdfRenderingOptions();
options.PageSetup.Sizing = SizingType.ScaleContent;
using (PdfDevice device = new PdfDevice(options, stream))
{
// Render SVG to PDF file
document.RenderTo(device);
}
}
// Load the PDF document
Document pdfDocument = new Document(stream);
// Save SVG file contents to output HTML format
pdfDocument.Save("Sample.html", SaveFormat.Html);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment