You can find all the details at: Merge SVG Images to PDF or XPS File in C#
Last active
September 18, 2021 12:51
-
-
Save aspose-com-gists/eed8155faecaa2a30d027c7df8d2d5e3 to your computer and use it in GitHub Desktop.
Merge SVG Images to PDF or XPS File | Combine SVG Image Files using C#
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
// Initialize SVG documents from files to merge later | |
SVGDocument document1 = new SVGDocument(dataDir + "owl.svg"); | |
SVGDocument document2 = new SVGDocument(dataDir + "conclusion.svg"); | |
SVGDocument document3 = new SVGDocument(dataDir + "Lineto.svg"); | |
// Create an instance of SvgRenderer | |
Rendering.SvgRenderer renderer = new Rendering.SvgRenderer(); | |
// Specify PdfRenderingOptions | |
var options = new PdfRenderingOptions() | |
{ | |
// Set Page Setup properties | |
PageSetup = | |
{ | |
Sizing = SizingType.FitContent | |
} | |
}; | |
// Create an instance of PdfDevice | |
PdfDevice device = new PdfDevice(options, dataDir + "Merged_PDF.pdf"); | |
// Merge or combine all SVG documents to a PDF file. | |
renderer.Render(device, document1, document2, document3); |
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
// Initialize SVG documents from files to merge later | |
SVGDocument document1 = new SVGDocument(dataDir + "owl.svg"); | |
SVGDocument document2 = new SVGDocument(dataDir + "conclusion.svg"); | |
SVGDocument document3 = new SVGDocument(dataDir + "Lineto.svg"); | |
// Create an instance of SvgRenderer | |
SvgRenderer renderer = new SvgRenderer(); | |
// Specify XPSRenderingOptions | |
var options = new XpsRenderingOptions() | |
{ | |
// Set XPS page size, margins, etc. | |
PageSetup = | |
{ | |
AnyPage = new Page(new Size(500, 500)) | |
} | |
}; | |
// Create an instance of XpsDevice | |
Xps.XpsDevice device = new Xps.XpsDevice(options, dataDir + "Merged_XPS.xps"); | |
// Merge or combine all SVG documents to an XPS file. | |
renderer.Render(device, document1, document2, document3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment