PDFDocumentOpen

サマリー

Returns a reference to an existing PDFDocument file on disk.

説明

A common scenario for using this function is to modify existing PDF file contents or properties. Once a is referenced, you can appendPages, insertPages, or deletePages, as well as use the updateDocProperties and updateDocSecurity methods to modify PDF file settings.

For your changes to be committed to disk, be sure to call saveAndClose after performing the PDFDocument operations.

構文

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

The PDFDocument object allows for the management of PDF documents, including facilities for merging and deleting pages, setting document open behavior, and creating or changing document security settings.

コードのサンプル

PDFDocumentOpen example

The following script modifies the PDF document metadata properties and sets the style in which the document will open.

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