Working with Pages | C++ API Solution

Add Pages to XPS Document

An XPS document can comprise of one or more pages. Aspose.Page for C++ allows adding pages to an XPS document without the requirement of any other software.

Add Pages

The XpsDocument class exposes the methods to add pages to an XPS document. In order to add pages to XPS document, use the following steps.

  1. Create an object of XpsDocument class.
  2. Use the AddPage or InsertPage methods to add a new page to the collection of the pages of the document
  3. Save the document using the Save method.
 1For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-C
 2// Create new XPS Document
 3auto doc = System::MakeObject<XpsDocument>(dataDir() + u"Sample1.xps");
 4
 5// Add empty page at end of pages list
 6doc->AddPage();
 7// Insert an empty page at beginning of pages list
 8doc->InsertPage(1, true);
 9
10// Save resultant XPS document
11doc->Save(outDir() + u"AddPages_out.xps");

Have any questions about Aspose.Page?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.