SVG (Scalable Vector Graphics) images are frequently used to maintain the quality of images. In some scenarios, you may need to merge or combine multiple SVG image files together. In this article, you will learn how to merge SVG images to a PDF or XPS file. Please explore the following sections for further details:
- Combine or Merge Multiple SVG Images to a Single PDF or XPS File – C# API Installation
- Merge SVG Images to a PDF File with C#
- Merge SVG Images to an XPS File using C#
Combine or Merge Multiple SVG Images to a Single PDF or XPS File – C# API Installation
Aspose.SVG for .NET API is designed to create, manipulate, or convert SVG files to supported file formats. You can easily use the API by downloading its reference files from the Downloads section, or using the following NuGet installation command:
PM> Install-Package Aspose.SVG
Merge SVG Images to a PDF File with C#
You can easily merge different SVG images into a PDF file. Each SVG image will be rendered on a separate page of the PDF file. To merge SVG files to a PDF file, you need to follow the steps below:
- Initialize SVG documents from files to merge images.
- Create an instance of SvgRenderer class.
- Specify different properties using PdfRenderingOptions object.
- Create an instance of PdfDevice class.
- Merge the SVG image files to a PDF document.
The following code shows how to merge or combine SVG images to a PDF document with C#:
Merge SVG Images to an XPS File using C#
You can merge SVG images to an XPS file with the following steps:
- Load input SVG Images to merge.
- Initialize an object of SvgRenderer class.
- Create an instance of XPSRenderingOptions class.
- Specify output XPS page size, margins, etc.
- Create an instance of XpsDevice type.
- Merge or combine all SVG documents to an XPS file.
The code sample below explains how to merge or combine SVG images to an XPS file in C#:
Get Free Temporary License
You can request a Free Temporary License to evaluate all the features of the API without any restrictions.
Conclusion
In this article, you have learned how to merge multiple SVG image files to a PDF or XPS file with high fidelity results. Both use cases are discussed along with the code samples so that you can quickly try out these features of the API. Furthermore, you can explore API Documentation to check out other features of the API. In case of any concerns, please feel free to contact us at the Free Support Forum.