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// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-.NET
 2// The path to the documents directory.
 3string dataDir = RunExamples.GetDataDir_WorkingWithPages();
 4// Create new XPS Document
 5XpsDocument doc = new XpsDocument(dataDir + "Sample1.xps");
 6
 7// Insert an empty page at beginning of pages list
 8doc.InsertPage(1, true);
 9            
10// Save resultant XPS document
11doc.Save(dataDir + "AddPages_out.xps");

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

You can download examples and data files from GitHub.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.