HPDFSaveContractAnnotatedPDFToStream

Saves an annotated review artifact from a borrowed document and restores its object graph on every exit

procedure HPDFSaveContractAnnotatedPDFToStream(Document: THotPDF; Output: TStream;
  const Report: THPDFContractCompareReport; Side: THPDFContractSide;
  CancellationToken: THPDFCancellationToken = nil; Checkpoint: TNotifyEvent = nil);

The unit is HPDFContractCompare; the document, stream, complete report, and valid side are required

Every semantic page must match the report snapshot before highlights are added; rectangles must be finite, positive, and refer to existing pages, and annotation count is capped at 1,000,000

Highlights use yellow with 0.28 opacity and the printable flag so review marks preserve readable underlying text

Export uses a graph transaction that always rolls back after serialization or failure; the caller owns the output stream and must discard partial output after failure

The optional token and checkpoint provide cooperative cancellation; an unbounded caller stream does not gain a byte limit, so supply a bounded stream or use the JSON comparison helper for private buffering and publication checks

The resulting PDF is a review copy produced by full serialization and needs separate signature validation

JSON and C ABI comparison ยท Contract comparison