FPdfWorkflowEvidence
Requires Enterprise since 3.266.0; link FPdfEnterprise or this unit from Lib\Enterprise
procedure AppendPdfWorkflowEvidence(var Evidence: TPdfWorkflowEvidence;
const Source, Output: TBytes; const Context: TPdfWorkflowEvidenceContext;
Outcome: TPdfWorkflowOutcome; const Reason: string; MaxSteps: Integer = 1000);
Append one operation's byte identities and context, named by Context.OperationName, to an evidence record, then export ToJson(Limits) or ToHtml(Limits)
Each accepted append adds one TPdfWorkflowEvidenceStep to Evidence.Steps (TPdfWorkflowEvidenceSteps); a step retains its Context, ProfileStatus, Outcome, OutputKind, SourceBytes/OutputBytes, SourceSha256/OutputSha256 and Reason
| Recorded information | Origin |
|---|---|
| Source/output SHA-256 and byte counts | Computed directly from the supplied byte arrays; absent output has an empty output hash |
| Library version | LibraryVersion records PdfComponentVersion from the linked library and serialises as libraryVersion; since 3.268.4 that is the bare release number such as 3.269.0 rather than the version and copyright label, and appending rejects a conflicting preexisting version label |
| Profile, minimum edition and implementation linkage | Captured from QueryPdfFeatureProfile with the supplied checks and retained on the step as ProfileStatus |
| Native/export/provider/document readiness | Caller-supplied Checks: TPdfFeatureChecks, retained with the query's state and reason |
| Native/provider identities, policy and resource budget | NativeIdentity, ProviderIdentity, Policy and ResourceBudget hold caller-supplied descriptions; use verified module paths/hashes, actual policy identifiers and operation limits |
| Outcome and reason | The caller's observed pwoSucceeded, pwoPartial, pwoRejected, pwoCancelled or pwoFailed result |
The original append treats output as a document: success requires nonempty output, ready supplied checks and OptInConfirmed=True for profiles requiring explicit opt-in; rejected, cancelled and failed steps cannot carry document output
Typed and read-only operations
Since 3.268.0, AppendPdfWorkflowEvidenceTyped takes OutputKind: TPdfWorkflowArtifactKind in addition to the existing parameters: pwakDocument identifies document bytes, pwakReport identifies diagnostics and pwakNone describes an inspection without an output artifact
A successful read-only step requires ready checks and any required opt-in, but no synthetic output; pwakNone always rejects nonempty output
Diagnostic reports may accompany failed, rejected or cancelled operations without claiming a published result document; both JSON and HTML expose OutputKind, and the existing JSON schema gains the additive outputKind field
AppendPdfWorkflowEvidenceTyped(Evidence, SourceBytes, nil, Context,
pwoSucceeded, pwakNone, 'Inspection completed');
AppendPdfWorkflowEvidenceStreams(Evidence, SourceStream, ReportStream,
Context, pwoSucceeded, pwakReport, 'Report created', MaxBytes);
The stream append computes byte identities in bounded chunks, preserves both original positions and accepts an optional cancellation token after MaxSteps; input and output each use MaxBytes
Verify recorded bytes
VerifyPdfWorkflowEvidenceStep(Step, Source, Output, MaxBytes, ErrorMessage, Token) recomputes byte counts and hashes from seekable streams and preserves their positions; read-only verification accepts a nil output
Verification returns false with an error on mismatched bytes, an invalid artifact kind, exhausted budget or cancellation; it verifies byte identity against the supplied in-memory step rather than authenticating the step, validating its outcome or certifying conformance
WriteJson(Writer) and WriteHtml(Writer) support direct bounded stream output; use a staged artifact bundle when a complete set of files must appear together
Invalid appends leave the step list unchanged; the default limit is 1000 steps and the maximum configurable limit is 65536
Steps can describe different documents or processing branches; this container does not automatically assert a chain between one step's output and the next step's input
Computed hashes establish byte identity only; environment identities, readiness checks and operation outcomes remain caller assertions, and this report is not independent conformance, trust or safety certification
The JSON schema is pdfiumpas.workflow-evidence.v1; report limits bound serialisation and escape untrusted text
Since 3.267.0, HTML also displays the profile/feature identifiers, minimum edition, linked implementation, readiness state/reason, all four prerequisite checks, supported/opt-in flags, byte counts, identities, policy, budgets and outcome reason present in JSON
Existing preflight reports, batch validation and rule execution remain available separately; attach their observed results and relevant pfpPadesTrustedEvidence, tagging, redaction or sanitisation profile context as needed