PDFDocumentOpen
汇总
返回对磁盘上现有 PDFDocument 文件的引用。
讨论
使用该函数的常见情形是修改现有 PDF 文件内容或属性。 引用 PDFDocument 后,即可执行 appendPages 、 insertPages 或 deletePages ,还可使用 updateDocProperties 和 updateDocSecurity 方法修改 PDF 文件设置。
对于要提交至磁盘的更改,请确保执行 PDFDocument 操作后调用 saveAndClose 。
语法
PDFDocumentOpen(pdf_path, {user_password}, {master_password})
| 参数 | 说明 | 数据类型 |
|---|---|---|
|
pdf_path |
A string that specifies the path and file name of the PDF file to open. |
String |
|
user_password |
A string that specifies the user password. The user password, if set, is what you need to provide in order to open a PDF. |
String |
|
master_password |
A string that specifies the master password. The master password, if set, controls permissions, such as printing, editing, extracting, commenting, and so on. |
String |
返回值
| 数据类型 | 说明 |
|---|---|
|
PDFDocument |
|
代码示例
以下脚本会修改 PDF 文档元数据属性并且设置文档以何种样式打开。
import arcpy
pdfDoc = arcpy.mp.PDFDocumentOpen(r"C:\Projects\YosemiteNP\AttractionsMapBook.pdf")
pdfDoc.updateDocProperties(pdf_title="Yosemite Main Attrations Map Book",
pdf_author="Esri",
pdf_subject="Main Attractions Map Book",
pdf_keywords="Yosemite; Map Books; Attractions",
pdf_open_view="USE_THUMBS",
pdf_layout="SINGLE_PAGE")
pdfDoc.saveAndClose()
del pdfDoc