Title, Subject, Creator, Author, KeyWords, DocGetTitle, DocGetSubject, DocGetCreator, DocGetAuthor, DocGetKeyWords, DocSetTitle, DocSetSubject, DocSetCreator, DocSetAuthor, and DocSetKeyWords

The Title, Subject, Creator, Author, and KeyWords properties can be defined by the user or developer to identify a PDF document.

 

Syntax

ActiveX:

System.String Title
System.String Subject
System.String Creator
System.String Author
System.String KeyWords

DLL:

int DocSetTitleA(EXTDOCHANDLE edhDocument, LPCSTR szValue)
int DocSetTitleW(EXTDOCHANDLE edhDocument, LPCWSTR szValue)
DocGetTitleW(EXTDOCHANDLE edhDocument, LPCWSTR szValue, int len)

int DocSetSubjectA(EXTDOCHANDLE edhDocument, LPCSTR szValue)
int DocSetSubjectW(EXTDOCHANDLE edhDocument, LPCWSTR szValue)
DocGetSubjectW(EXTDOCHANDLE edhDocument, LPCWSTR szValue, int len)

int DocSetCreatorA(EXTDOCHANDLE edhDocument, LPCSTR szValue)
int DocSetCreatorW(EXTDOCHANDLE edhDocument, LPCWSTR szValue)
DocGetCreatorW(EXTDOCHANDLE edhDocument, LPCWSTR szValue, int len)

int DocSetAuthorA(EXTDOCHANDLE edhDocument, LPCSTR szValue)
int DocSetAuthorW(EXTDOCHANDLE edhDocument, LPCWSTR szValue)
DocGetAuthorW(EXTDOCHANDLE edhDocument, LPCWSTR szValue, int len)

int DocSetKeywordsA(EXTDOCHANDLE edhDocument, LPCSTR szValue)
int DocSetKeywordsW(EXTDOCHANDLE edhDocument, LPCWSTR szValue)
DocGetKeywordsW(EXTDOCHANDLE edhDocument, LPCWSTR szValue, int len)

 

Parameters

Title, szValue

[in, out] Document title, should be an Ansi string for DocSetTitleA or a Unicode string for DocSetTitleW.

Subject, szValue

[in, out] Document subject, should be an Ansi string for DocSetSubjectA or a Unicode string for DocSetSubjectW.

Creator, szValue

[in, out] Application used to create the PDF document, should be an Ansi string for DocSetCreatorA or a Unicode string for DocSetCreatorW.

Author, szValue

[in, out] Person who wrote the document, should be an Ansi string for DocSetAuthorA or a Unicode string for DocSetAuthorW.

KeyWords, szValue

[in, out] List of keywords separated by semi-colons (;), should be an Ansi string for DocSetKeywordsA or a Unicode string for DocSetKeywordsW.

edhDocument

Handle Returned by DocOpen.

len

Size of the szValue buffer where the string value should be returned.

 

Remarks

All these properties are optional are not found in all PDF documents.

 

 

Member of CDIntfEx.Document.

 

Example

Public Sub Sample()

    ' Constants for Activation codes

    Const strLicenseTo As String = "Amyuni PDF Converter Evaluation"

    Const strActivationCode As String = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

 

    ' Declare a new cdintfex document if it does not exist in the form.

    Dim pdfDoc As New CDIntfEx.Document

 

    ' The SetLicenseKey method should be called after creating an object of type 

    ' CDIntfEx.Document to activate the advanced methods that require the object 

    ' activation code to work properly

    pdfDoc.SetLicenseKey(strLicenseTo, strActivationCode)

 

    ' Set title

    pdfDoc.Title = "Amyuni PDF Document"

 

    ' Set Subject

    pdfDoc.Subject = "Code Sample"

 

    ' Set Creator

    pdfDoc.Creator = "Amyuni"

 

    ' Set Author

    pdfDoc.Author = "Bill Smith"

 

    ' Set Keywords separated by semi-colons (;).

    pdfDoc.KeyWords = "PDF; printer; document; testing"

 

    ' Save the document

    pdfDoc.Save("c:\temp\test.pdf")

End Sub

public void Sample()

{

    // Constants for Activation codes

    const string strLicenseTo = "Amyuni PDF Converter Evaluation";

    const string strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";

 

    // Declare a new cdintfex document if it does not exist in the form.

    CDIntfEx.Document pdfDoc = new CDIntfEx.Document();

 

    // The SetLicenseKey method should be called after creating an object of type 

    // CDIntfEx.Document to activate the advanced methods that require the object 

    // activation code to work properly

    pdfDoc.SetLicenseKey(strLicenseTo, strActivationCode);

 

    // Set title

    pdfDoc.Title = "Amyuni PDF Document";

 

    // Set Subject

    pdfDoc.Subject = "Code Sample";

 

    // Set Creator

    pdfDoc.Creator = "Amyuni";

 

    // Set Author

    pdfDoc.Author = "Bill Smith";

 

    // Set Keywords separated by semi-colons (;).

    pdfDoc.KeyWords = "PDF; printer; document; testing";

 

    // Save the document

    pdfDoc.Save(@"c:\temp\test.pdf");

}

// PDF Converter Cpp.cpp : Defines the entry point for the console application.

// 

 

#include <Windows.h>

#include <string>

#include <iostream>

#include "CdIntf.h"

#pragma comment (lib, "CDIntf.lib")

 

using namespace std;

int main()

{

     // Constants for Activation codes

    #define strLicenseTo  "Amyuni PDF Converter Evaluation"

    #define strActivationCode "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

 

    // Declare a new cdintfex document if it does not exist in the form.

    EXTDOCHANDLE pdfDoc;

 

    // Open the document

    LPBYTE passWord = nullptr;

    DocOpenA(&pdfDoc, "C:\temp\\test.pdf", passWord);

 

    // The SetLicenseKey method should be called after creating an object of type 

    // CDIntfEx.Document to activate the advanced methods that require the object 

    // activation code to work properly

    SetLicenseKeyA(strLicenseTo, strActivationCode);

 

    // Set title

    DocSetTitleA(pdfDoc, "Amyuni PDF Document");

 

    // Set Subject

    DocSetSubjectA(pdfDoc, "Code Sample");

 

    // Set Creator

    DocSetCreatorA(pdfDoc, "Amyuni");

 

    // Set Author

    DocSetAuthorA(pdfDoc, "Bill Smith");

 

    // Set Keywords separated by semi-colons (;).

    DocSetKeywordsA(pdfDoc, "PDF; printer; document; testing");

 

    // Save the document

    DocSaveA(pdfDoc, "C:\temp\\test.pdf");

 

    // Destroy pdfDoc object

    DocClose(pdfDoc);

    pdfDoc = nullptr;

 

    return 0;

}

package Example;

 

import com.jacob.activeX.ActiveXComponent;

import com.jacob.com.Dispatch;

import com.jacob.com.Variant;

 

public class Sample {

    public static void main(String[] args)

    {

        // Constants for Activation codes

        String strLicenseTo  = "Amyuni PDF Converter Evaluation";

        String strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";

 

        // Declare a new cdintfex object if it does not exist in the form.

        ActiveXComponent pdfDoc = new ActiveXComponent("CDIntfEx.Document.6.5"); 

 

        // The SetLicenseKey method should be called after creating an object of type 

        // CDIntfEx.Document to activate the advanced methods that require the object 

        // activation code to work properly

        Dispatch.call(pdfDoc, "SetLicenseKey", strLicenseTo, strActivationCode);

 

        // Set title

        Dispatch.put(pdfDoc, "Title", "Amyuni PDF Document");

 

        // Set Subject

        Dispatch.put(pdfDoc, "Subject", "Code Sample");

 

        // Set Creator

        Dispatch.put(pdfDoc, "Creator", "Amyuni");

 

        // Set Author

        Dispatch.put(pdfDoc, "Author",  "Bill Smith");

 

        // Set Keywords separated by semi-colons (;).

        Dispatch.put(pdfDoc, "KeyWords", "PDF; printer; document; testing");

 

        // Save the document

        Dispatch.call(pdfDoc, "Save", "C:\temp\\test.pdf");

 

        // Destroy pdfDoc object

        pdfDoc = null;

    }

}

# Constants for Activation codes

$strLicenseTo  =  "Amyuni PDF Converter Evaluation"

$strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

 

#Declare a new cdintfex document if it does not exist in the form.

$pdfDoc = New-Object -ComObject CDIntfEx.Document.6.5

 

#The SetLicenseKey method should be called after creating an object of type 

#CDIntfEx.Document to activate the advanced methods that require the object 

#activation code to work properly

[System.__ComObject].InvokeMember('SetLicenseKey', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc, @($strLicenseTo, $strActivationCode))

 

#Set Title

[System.__ComObject].InvokeMember('Title', [System.Reflection.BindingFlags]::SetProperty,$null,$pdfDoc,"Amyuni PDF Document") 

 

 #Set Subject

[System.__ComObject].InvokeMember('Subject', [System.Reflection.BindingFlags]::SetProperty,$null,$pdfDoc,"Code Sample") 

 

#Set Creator

[System.__ComObject].InvokeMember('Creator', [System.Reflection.BindingFlags]::SetProperty,$null,$pdfDoc,"Amyuni") 

 

#Set Author

[System.__ComObject].InvokeMember('Author', [System.Reflection.BindingFlags]::SetProperty,$null,$pdfDoc,"Bill Smith") 

 

#Set Keywords separated by semi-colons (;).

[System.__ComObject].InvokeMember('KeyWords', [System.Reflection.BindingFlags]::SetProperty,$null,$pdfDoc,"PDF; printer; document; testing") 

 

#Save the document

[System.__ComObject].InvokeMember('Save', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,"c:\temp\test.pdf") 

 

#Destroy pdfDoc object

$pdfDoc = $null

' Constants for Activation codes

Const strLicenseTo = "Amyuni PDF Converter Evaluation"

Const strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

 

' Declare a new Document object

Dim pdfDoc

Set pdfDoc = CreateObject("CDIntfEx.Document.6.5")

 

' The SetLicenseKey method should be called after creating an object of type 

' CDIntfEx.Document to activate the advanced methods that require the object 

' activation code to work properly

pdfDoc.SetLicenseKey strLicenseTo, strActivationCode

 

' Set title

pdfDoc.Title = "Amyuni PDF Document"

 

' Set Subject

pdfDoc.Subject = "Code Sample"

 

' Set Creator

pdfDoc.Creator = "Amyuni"

 

' Set Author

pdfDoc.Author = "Bill Smith"

 

' Set Keywords separated by semi-colons (;).

pdfDoc.KeyWords = "PDF; printer; document; testing"

 

' Save the document

pdfDoc.Save "c:\temp\test.pdf"

 

' Destroy pdfDoc object

Set pdfDoc = Nothing