AnalyzeModifications
Diagnostics
Requires the Small Business edition — in Delphi, C++Builder and Lazarus code create the library as TPDFlibSmallBusiness (unit PDFlibSmallBusiness) or TPDFlibEnterprise; the Small Business and Enterprise DLL and ActiveX builds provide it unchanged; the Single edition keeps the method, which returns 0, an empty string or False and sets LastErrorCode to 901 (PDFLIB_ERROR_SMALLBUSINESS_REQUIRED)
Description
Classifies every change since a saved revision against the modification whitelist used by signature validation
Syntax
Delphi
Function AnalyzeModifications(Const OldFileName, OldPassword: WideString): Integer; Virtual;ActiveX
Function PDFlib::AnalyzeModifications(OldFileName As String, OldPassword As String) As LongDLL
int DLAnalyzeModifications(int InstanceID, const wchar_t* OldFileName, const wchar_t* OldPassword);
int DLAnalyzeModificationsA(int InstanceID, const char* OldFileName, const char* OldPassword);Parameters
| OldFileName | Path of the saved revision loaded as the pre-change side |
|---|---|
| OldPassword | Password for OldFileName, or an empty string when it is not encrypted |
Return values
| 0 | No document is selected, the file does not exist or could not be loaded |
|---|---|
| N | Number of classified findings; read the overall level with GetModificationLevel |
Remarks
Loads OldFileName as the pre-change side, runs the structural comparison of CompareWith, then classifies each added or changed object from its post-change form: DSS and VRI dictionaries, cross-reference streams, catalog metadata and appended signature dictionaries count as LTA updates; dictionaries carrying a field type with a set value count as form filling; annotation dictionaries by type or ISO 32000-2 Table 168 subtype count as annotations. A dictionary is accepted as a DSS or a signature dictionary only when every key it carries belongs to that kind of dictionary, and a changed object keeps its class only when the object it replaced was of the same kind, so a page, font or resource dictionary rewritten with such keys or types stays unclassified. Everything else, including removed non-LTA objects and page-count differences, is unclassified. The overall level is the maximum across findings, ordered none, LTA updates, form filling, annotations, unclassified, so a DocMDP level check reduces to comparing GetModificationLevel against the policy
Example
if PDF.AnalyzeModifications("signed_v1.pdf", "")> 0 then
Level:= PDF.GetModificationLevel;