使用 Pages | C++ API 解决方案

向 XPS 文档添加页面

一个 XPS 文档可以包含一个或多个页面。Aspose.Page for C++ 允许在 XPS 文档中添加页面,而无需任何其他软件。

添加页面

XpsDocument 类提供了向 XPS 文档添加页面的方法。 要向 XPS 文档添加页面,请执行以下步骤。

  1. 创建 XpsDocument 类的对象。
  2. 使用 AddPage 或 InsertPage 方法将新页面添加到文档页面集合中。
  3. 使用 Save 方法保存文档。
 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");