You can read all details at: Convert SVG to PDF or XPS Programmatically using C# VB.NET
Created
January 18, 2021 21:41
-
-
Save aspose-com-gists/98ee00c04dffa3583490620b4d2ce029 to your computer and use it in GitHub Desktop.
Convert SVG to PDF or XPS Programmatically using C# VB.NET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load input SVG file | |
using (var document = new SVGDocument(Path.Combine(dataDir, "smiley.svg"))) | |
{ | |
// Specify PdfRenderingOptions | |
var options = new PdfRenderingOptions() | |
{ | |
// Set Page Setup properties | |
PageSetup = | |
{ | |
Sizing = SizingType.FitContent | |
} | |
}; | |
using (var device = new PdfDevice(options, dataDir + "smiley_out.pdf")) | |
{ | |
// Render SVG to PDF | |
document.RenderTo(device); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load input SVG file | |
using (var document = new SVGDocument(Path.Combine(dataDir, "smiley.svg"))) | |
{ | |
// Specify XPSRenderingOptions | |
var options = new XpsRenderingOptions() | |
{ | |
// Set PDF page size, margins, etc. | |
PageSetup = | |
{ | |
AnyPage = new Page(new Size(500, 500)) | |
} | |
}; | |
using (var device = new XpsDevice(options, dataDir + "smiley_out.xps")) | |
{ | |
// Render SVG to XPS | |
document.RenderTo(device); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment