http://www.verypdf.com/  Home  PDFTools  Document  Support  Articles  Products  Downloads

PDF Information Editor - Advanced PDF Tools
Change Creator, Producer, Dates, Author, Title, Subject & Keywords
Resize, rotate PDF pages, set page margin
Set open actions, compress PDF files

You can use PDF Information Editor application to read and write PDF Document Information Properties, Document information properties are a quite helpful subset of a document's metadata. PDF Information might be valuable programs such as file indexing solutions, lookup engine spiders, and PDF viewers and printers. Document properties can also be valuable for human consumers. With this article, you will to read and compose document data properties such as title, author, subject, and keywords.

Reading and Writing PDF Document Information Properties In VB Script Language by VeryPDF PDF Information Editor COM/SDK product,

Set oPDF = CreateObject("PDFSDKCOMExe.pdftools")
oPDF.OpenPDFFile "C:\test.pdf"
If oPDF.IsOpened = False Then
  MsgBox "Open PDF file failed."
Else
  MsgBox "Open PDF file successful."
End If

strMsg = strMsg & "Title: " & oPDF.Title & vbCrLf
strMsg = strMsg & "Author: " & oPDF.Author & vbCrLf
strMsg = strMsg & "Subject: " & oPDF.Subject & vbCrLf
strMsg = strMsg & "Keywords: " & oPDF.Keywords & vbCrLf
strMsg = strMsg & "CreatedDate: " & oPDF.CreatedDate & vbCrLf
strMsg = strMsg & "ModifiedDate: " & oPDF.ModifiedDate & vbCrLf
strMsg = strMsg & "Creator: " & oPDF.Creator & vbCrLf
strMsg = strMsg & "Producer: " & oPDF.Producer & vbCrLf
strMsg = strMsg & "Permission: " & CStr(oPDF.Permission) & vbCrLf
strMsg = strMsg & "EncryptKeyLength: " & CStr(oPDF.EncryptKeyLength) & vbCrLf

MsgBox "The document summaries of the PDF is: " & vbCrLf & strMsg

oPDF.DeleteMetadata

oPDF.Title = "New Title"
oPDF.Author = "New Author"
oPDF.Subject = "New Subject"
oPDF.Keywords = "New Keywords"
oPDF.CreatedDate = "D:20080808112220+00'00'"
oPDF.ModifiedDate = "D:20080808112220+00'00'"
oPDF.Creator = "New Creator"
oPDF.Producer = "New Producer"

MsgBox "Change the new document summaries to this PDF file."

oPDF.Save "C:\out.pdf"

oPDF.Title = vbNullString
oPDF.Author = vbNullString
oPDF.Subject = vbNullString
oPDF.Keywords = vbNullString
oPDF.CreatedDate = vbNullString
oPDF.ModifiedDate = vbNullString
oPDF.Creator = vbNullString
oPDF.Producer = vbNullString

MsgBox "Change the new document summaries to Blank."

oPDF.Save "C:\out_blank.pdf"
'SaveEx(BSTR lpszPDFFile, long nKeyLen, long nPermission, BSTR lpszOpenPassword, BSTR lpszOwnerPassword)
'
'lpszPDFFile : Output PDF filename
'nKeyLen=X : Key length (40 or 128 bit)
' nKeyLen=-1 : No encryption
' nKeyLen=0 : 40 bit RC4 encryption (Acrobat 3 or higher)
' nKeyLen=1 : 128 bit RC4 encryption (Acrobat 5 or higher)
' nKeyLen=2 : 128 bit AES encryption (Acrobat 7 or higher)
'nPermission=XXX : Set Permissions
' nPermission=0 : Deny anything
' nPermission=1 : Allowed print the document
' nPermission=2 : Allowed modify the content of the document
' nPermission=4 : Allowed copy text and graphics from the document
' nPermission=8 : Allowed add or modify annotations
' nPermission=16 : Allowed fill in interactive form fields
' nPermission=32 : Allowed extract text and graphics from the document
' nPermission=64 : Allowed assemble the document
' nPermission=128 : Allowed print the document with high resolution
'lpszOpenPassword=XXX : Set 'open password' to PDF file
'lpszOwnerPassword=XXX : Set 'owner password' to PDF file
oPDF.SaveEx "C:\out_blank_encrypted.pdf", 1, 1 + 128, "123", "456"

oPDF.OpenEx "C:\out_blank_encrypted.pdf", "123", ""
oPDF.Title = "Decrypted PDF file"
oPDF.Save "C:\out_blank_decrypted.pdf"
MsgBox "Save PDF file successful."


PDF Information Editor SDK is can also able to edit the Custom Properties, what is the difference between "custom properties" and "standard properties"?

PDF 1.0->1.3 stored document-level metadata in an area of the PDF called the Document Info Dictionary. The PDF Reference listed a series of "well known keys" that could be there, but a user/developer could add any keys that they wanted. In PDF 1.4 and later, that was superseded by an XML-based metadata format called XMP. It also maintained the idea of known elements and custom elements. These metadata values along with other "file system information" are presented by Adobe Acrobat (and Reader) in the Document Properties panel.

Custom Properties Screenshot

You can use following sample source code to append, edit and clear custom properties provided by PDF Information Editor SDK,

Set oPDF = CreateObject("PDFSDKCOMExe.pdftools")
oPDF.OpenPDFFile "C:\test.pdf"
If oPDF.IsOpened = False Then
MsgBox "Open PDF file failed."
Else
MsgBox "Open PDF file successful."
End If

MsgBox "The document CustomProperties of the PDF is: " & vbCrLf & oPDF.CustomProperties

strNewCustomProperties = "Our Company=VeryPDF Company,Support Email=support@verypdf.com,Our Web URL=http://www.verypdf.com"

oPDF.AppendCustomProperties (strNewCustomProperties)

oPDF.Save "C:\out_NewCustomProperties.pdf"

'Append new CustomProperties
oPDF.OpenPDFFile "C:\out_NewCustomProperties.pdf"
MsgBox "The document CustomProperties of the PDF is: " & vbCrLf & oPDF.CustomProperties
oPDF.AppendCustomProperties ("+TestCompany=VeryDOC,TestEmail=support@verypdf.com,TestWebURL=http://www.verypdf.com")
oPDF.Save "C:\out_NewCustomProperties_append.pdf"

'Remove CustomProperties
oPDF.OpenPDFFile "C:\out_NewCustomProperties_append.pdf"
MsgBox "The document CustomProperties of the PDF is: " & vbCrLf & oPDF.CustomProperties
oPDF.ClearCustomProperties
oPDF.Save "C:\out_NewCustomProperties_removed.pdf"
MsgBox "Save PDF file successful."


Download the trial version of PDF Information Editor SDK for evaluation.

Click here to learn more...


Home | Products | Downloads | Support | Links | Contact

Copyright © 2000- VeryPDF.com, Inc. All rights reserved.
Send comments about this site to the webmaster.