Working with Pages | C++ API Solution
Contents
[
Hide
Show
]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.
- Create an object of XpsDocument class.
- Use the AddPage or InsertPage methods to add a new page to the collection of the pages of the document
- 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");