How do I
delete document info from a PDF file using PXCp_SetDocumentInfoExW?
How do I delete document Info from a PDF file using PXCp_SetDocumentInfoExW?
Using PXCp_SetDocumentInfoExW I can set info in a PDF file.
But how can I delete them?
I tried setting them to a blank string, but it doesn't seem to work, the value of another property is set. Why?
var str_name, str_value : string;
PXCp_SetDocumentInfoExW(pdf, PWChar(WideString(str_name)), PWChar(WideString(str_value)));
You can clear an Info string using Low-Level API, but if setting it to empty will be enough, you may call PXCp_SetDocumentInfoExW:
PXCp_SetDocumentInfoExW(hPdfDocument, L"Key name to clear", L"")
The only way to truly clear the Info String, currently, though, is to use the Low-Level API (see code example below).
Code (C++ Example):
HPDFSTRING pKey = NULL;
hr = PXCp_llGetDocTrailer(hDocument, &Dict);
if (Dict == NULL)
hr = PXCp_DictionaryGetKeyByStr(Dict, "Info", 4", pInfoVar);
hr = PXCp_VariantGetType(pInfoVar, &t);
if (t != PVT_OBJREF)
// Actually info should be indirect dictionary
hr = PXCp_VariantGetObject(pInfoVar, &pInfoObj);
if (pInfoObj == NULL)
hr = PXCp_ObjectGetDictionary(pInfoObj, &pInfoDict);
if (pInfoDict == NULL)
pKey = PXCp_StringCreate();
if (pKey == NULL)
hr = PXCp_StringSetA(pKey, "My custom info")
hr = PXCp_DictionaryClearValue(pInfoDict, pKey, TRUE);
} while (FALSE);
if (pKey != NULL)
You will need the PDF-XChange PRO SDK license to be able to use the Low-Level API functions in anything other than evaluation mode.
The Low-Level API is a set of powerful functions allowing developers to access the very heart of a PDF page/file and make changes of the most fundamental nature - with this power comes a price, indiscriminate use of the Low-Level API functions will undoubtedly lead to file corruption and problems - these functions are not to be used in haste and we accept no responsibility whatsoever for developers use of these functions - use with caution!
When requesting support regarding the Low-Level API functions you will be expected to have a thorough working knowledge of the PDF format and the associated documentation from Adobe - we regret we cannot and will not 'educate' developers in this vast and complex subject.
We do provide limited documentation in the PDF-ToolsV4SDK.pdf Help File (Topic 3.2 Low-Level API, pg. 377)
The best reference for the Low-Level API is The Adobe PDF Reference, Sixth Edition, is available as a PDF portfolio from Adobe but has been superseded by the ISO 32000-1 document. Both documents provide a description of the PDF file format and are intended primarily for developers of PDF producer applications that create PDF files directly. These documents also contain enough information to allow developers to write PDF consumer applications that read existing PDF files and interpret or modify their contents.
The Document management - PDF - Part 1 First Edition is an ISO approved copy of the ISO 32000-1 Standards document. By agreement with ISO, Adobe Systems Incorporated is allowed to offer this version of the ISO standard as a free PDF file on their web site. It is not an official ISO document but the technical content is identical including the section numbering and page numbering.