在 XPS 文件中使用页面 | Python
Contents
[
Hide
Show
]XPS 文档中的页面管理涉及添加、删除、重新排列或访问单个页面等任务。
添加页面
Aspose.Page for Python via .NET 提供了 XpsDocument 类,其中包含用于向 XPS 文档添加页面的 set_insert_page() 方法。以下代码片段演示了如何使用此方法向 XPS 文档添加页面:
1# The path to the documents directory.
2data_dir = Util.get_data_dir_working_with_pages()
3# Create a new XPS Document
4doc = XpsDocument(data_dir + "Sample1.xps")
5
6# Insert an empty page at the beginning of the pages list
7doc.insert_page(1, True)
8
9# Save the resultant XPS document
10doc.save(data_dir + "AddPages_out.xps")
您可以从 GitHub下载示例和数据文件。