XPS ファイルのページ操作 | Python
Contents
[
Hide
Show
]XPS ドキュメント内のページ管理には、個々のページの追加、削除、並べ替え、アクセスなどのタスクが含まれます。
ページの追加
Aspose.Page for Python via .NET は、XPS ドキュメントにページを追加するための set_insert_page() メソッドを含む XpsDocument クラス を提供します。次のコード スニペットは、このメソッドを使用して XPS ドキュメントにページを追加する方法を示しています。
1from aspose.page.xps import *
2from util import Util
3# The path to the documents directory.
4data_dir = Util.get_data_dir_working_with_pages()
5# Create a new XPS Document
6doc = XpsDocument(data_dir + "Sample1.xps")
7
8# Insert an empty page at the beginning of the pages list
9doc.insert_page(1, True)
10
11# Save the resultant XPS document
12doc.save(data_dir + "AddPages_out.xps")サンプルとデータ ファイルは GitHub からダウンロードできます。