THotPDF.PreparePDFForSigning Method
Method summary: THotPDF.PreparePDFForSigning Method
Declaration
class function PreparePDFForSigning(var PDFBytes: AnsiString; out Range1Start: Integer; out Range1Length: Integer; out Range2Start: Integer; out Range2Length: Integer; out ContentsHexStart: Integer; out ContentsHexLen: Integer): boolean;
Remarks
PDFBytes is the saved document that THPDFPage.AddSignedSignatureField prepared. The method rewrites the /ByteRange placeholder in place with the real values and returns False when it finds no placeholder
Range1Start,Range1Length,Range2StartandRange2Lengthare file offsets and lengths counted from zero. Hash the two ranges in that order to obtain the digest covered by the CMS signature- The bytes between the ranges form the complete
/Contentshexadecimal string —<and>delimiters included — exactly as ISO/IEC 32000-1 12.8.3.3 requires ContentsHexStartis the one-based index of the first hex digit withinPDFBytes, andContentsHexLencounts the hex digits reserved. Hand the hex-encoded signature toInsertSignatureHex, which pads a shorter value with trailing zeros