ImportPDFDocInformation

Description

Imports the documentation information of the specified PDF document into the current PDFDocument object.

Applies to

PDFDocument object

Syntax

long ImportPDFDocInformation(string fileName, PDFDocInformation docInfo, string masterPassword)
long ImportPDFDocInformation(string fileName, PDFDocInformation docInfo)

Argument

Description

fileName

The name of the PDF document to import the document information from.

docInfo

The PDFDocInformation is the enumerated data type representing what documentation information to import. Values are:

  • PDFDocInfo_All! -- Imports both the document properties and security settings

  • PDFDocInfo_Properties! -- Only imports the document properties

  • PDFDocInfo_Security! -- Only imports the document security settings

    Note

    The security settings do not include masterpassword and userpassword. For the security settings to take effect, you must manually specify the passwords for the PDFDocument object before or after the import.
masterPassword If required, the master password required by the PDF document to import the document information from.

Return value

Long. Returns 1 if it succeeds and -1 if it fails. Returns null if any argument is null. For more errors, see the Error Codes.

Examples

The following example imports the properties of the "propertiestestNoPwd.pdf" document into the current PDFDocument object.

PDFdocument lpdf_doc
lpdf_doc = create PDFdocument
long ll_return 

lpdf_doc.importpdf ("D:\save\propertiestestNoPwd.pdf")
//Only imports the properties
ll_return = lpdf_doc.importpdfdocinformation ("D:\save\propertiestestNoPwd.pdf",PDFDocInfo_Properties!)

lpdf_doc.save ("D:\save\propertiestestnopwdtest.pdf")

The following example imports both the properties and security settings of the "propertiestestPwd.pdf" document into the current PDFDocument object.

PDFdocument lpdf_doc
lpdf_doc = create PDFdocument
long ll_return 

lpdf_doc.importpdf ("D:\save\propertiestestPwd.pdf","pwd123")
//PDFDocInfo_All, "pwd123" is the master password of propertiestestPwd.pdf 
ll_return = lpdf_doc.importpdfdocinformation ("D:\save\propertiestestPwd.pdf",PDFDocInfo_All!,"pwd123")
//Specify the masterpassword and userpassword for the imported security settings to take effect
lpdf_doc.security.masterpassword="newpwd123"
lpdf_doc.security.userpassword="newpwd321"

lpdf_doc.save ("D:\save\propertiestestpwdtestANDsecurityAll.pdf")