PDFDocumentOpen
Краткая информация
Возвращает ссылку на имеющийся на диске файл PDFDocument.
Обсуждение
Распространенным сценарием использования этой функции является изменение имеющегося содержимого или свойств PDF-файла. После ссылки на PDFDocument вы можете appendPages, insertPages или deletePages, а также использовать методы updateDocProperties и updateDocSecurity для изменения настроек PDF-файла.
Чтобы ваши изменения были сохранены на диске, обязательно запустите saveAndClose после выполнения операций PDFDocument.
Синтаксис
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