From 25fbea205ff62f35d738884a73fd145b1a9618a6 Mon Sep 17 00:00:00 2001 From: TekH Date: Tue, 21 Jul 2026 12:27:52 +0200 Subject: [PATCH] feat(infrastructure): Add IPdfProcessor.AddAnnotationAsync interface - Add AddAnnotationAsync method with 8 parameters - Support Stream-based PDF input (Position=0 required) - Accept annotation type, page number, rectangle coordinates - Optional parameters: content, author, color (hex), textMarkupStyle - Returns annotated PDF as byte array --- .../Common/Interfaces/IPdfProcessor.cs | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/DocumentOperator.Application/Common/Interfaces/IPdfProcessor.cs b/DocumentOperator.Application/Common/Interfaces/IPdfProcessor.cs index 667c07b..d3aad79 100644 --- a/DocumentOperator.Application/Common/Interfaces/IPdfProcessor.cs +++ b/DocumentOperator.Application/Common/Interfaces/IPdfProcessor.cs @@ -76,4 +76,33 @@ public interface IPdfProcessor /// or page range format is invalid /// Task MergePdfsAsync(IReadOnlyList pdfStreams, IReadOnlyList? pageRanges = null); + + /// + /// Adds an annotation to a PDF document at the specified page and rectangle. + /// + /// + /// PDF document stream. Must be readable and positioned at the beginning (Position = 0). + /// Non-seekable streams are supported. Caller is responsible for disposal. + /// + /// Type of annotation to add (TextMarkup, FreeText, StickyNote, Circle, Square) + /// Page number (1-based) where annotation should be added + /// Annotation bounding rectangle (X1, Y1, X2, Y2) in PDF coordinates + /// Annotation content/comment text (required for FreeText and StickyNote) + /// Optional author name + /// Optional annotation color in RGB format (hex string like "FF0000" for red) + /// Text markup style (Highlight, Underline, Strikeout) - only for TextMarkup type + /// Annotated PDF as byte array + /// + /// Thrown when stream is empty/invalid/not at Position=0, page number out of range, + /// rectangle invalid, or content missing for types that require it + /// + Task AddAnnotationAsync( + Stream pdfStream, + Domain.Models.ValueObjects.AnnotationType annotationType, + int pageNumber, + (double X1, double Y1, double X2, double Y2) rectangle, + string? content = null, + string? author = null, + string? color = null, + Domain.Models.ValueObjects.TextMarkupStyle? textMarkupStyle = null); } \ No newline at end of file