ImageGear for C and C++ on Windows v20.1 - Updated
Manage PDF Metadata
User Guide > How to Work with ... > Formats with Additional Functionality > PDF > How to... > Manage PDF Content > Manage PDF Metadata

Before working with a PDF document, make sure to initialize the PDF component (see Getting Started with PDF).

You can get and set PDF document metadata corresponding to a document's Info dictionary.

To manage PDF metadata you can use the IG_PDF_doc_get_info and IG_PDF_doc_set_info functions. The following example illustrates the usage of these methods:

C and C++
Copy Code
void SetMetadata(HIG_PDF_DOC pdfDocument)
{
   LONG currentLength;

   // Get the length of the current value of the dictionary key "Author".
   IG_PDF_doc_get_info(pdfDocument, "Author", NULL, 0, &currentLength);

   // If empty, set the dictionary key "Author" to "Accusoft".
   if (currentLength == 0)
   {
       IG_PDF_doc_set_info(pdfDocument, "Author", "Accusoft", strlen("Accusoft"));
   }
}

Remarks

Some standard document information dictionary keys are read-only. See IG_PDF_doc_set_info for more information.

See Section 10.2.1 in the PDF Reference for information about Info dictionaries. All values in the Info dictionary should be strings; other data types, such as numbers and Booleans, should not be used as values in the Info dictionary.

Users may define their own Info dictionary entries. In this case, it is strongly recommended that the keys have the developer's prefix assigned by the Adobe Solutions Network.

Is this page helpful?
Yes No
Thanks for your feedback.