Working with Pages in XPS file | .NET

Contents
[ Hide Show ]

Add Pages to XPS Document

Aspose.Page for .NET offers XpsDocument class, which exposes the InsertPage method that can be used to add pages to an XPS document. The following code snippet shows complete functionality to add pages to the XPS document:

 1// Add page to XPS document.
 2
 3// Create new XPS Document
 4XpsDocument doc = new XpsDocument(DataDir + "Sample1.xps");
 5
 6string outputFileName = "AddPages_out.xps";
 7
 8// Insert an empty page at beginning of pages list
 9doc.InsertPage(1, true);
10
11// Save resultant XPS document
12doc.Save(OutputDir + outputFileName);
Example-AddPageXPS.cs hosted with ❤ by GitHub

See working with pages in XPS documents in Java and C++.

You can download examples and data files from GitHub.

Have any questions about Aspose.Page?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.