From adaf57e3d040b19569588000dbd4338d426e6def Mon Sep 17 00:00:00 2001 From: Julien R Date: Wed, 18 Oct 2023 15:19:02 +0200 Subject: [PATCH] expose PdfString's start and end bytes positions in Stream This will make possible the implementation of document signature, because we need to exclude this specific byte range from the hash digest. --- .../src/PDFsharp/src/PdfSharp/Pdf/PdfString.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/foundation/src/PDFsharp/src/PdfSharp/Pdf/PdfString.cs b/src/foundation/src/PDFsharp/src/PdfSharp/Pdf/PdfString.cs index eccb3cae..36a8920c 100644 --- a/src/foundation/src/PDFsharp/src/PdfSharp/Pdf/PdfString.cs +++ b/src/foundation/src/PDFsharp/src/PdfSharp/Pdf/PdfString.cs @@ -284,7 +284,21 @@ static bool IsRawEncoding(string s) /// internal override void WriteObject(PdfWriter writer) { + PositionStart = writer.Position; + writer.Write(this); + + PositionEnd = writer.Position; } + + /// + /// Position of the first byte of this string in PdfWriter's Stream + /// + public int PositionStart { get; internal set; } + + /// + /// Position of the last byte of this string in PdfWriter's Stream + /// + public int PositionEnd { get; internal set; } } }