From b20d25e5b93f00e03f3d31621ca28ef8ee300123 Mon Sep 17 00:00:00 2001 From: TekH Date: Fri, 7 Nov 2025 13:21:33 +0100 Subject: [PATCH] feat(BurnPdfCommandHandler): implement AddInkAnnotation for freehand annotations - Added implementation for AddInkAnnotation(int page, string value) to render ink annotations from JSON. - Deserialize ink lines and stroke color, convert points to PDF coordinates, and add as freehand annotations. - Retained placeholder for AddInkAnnotation(Annotation pAnnotation) for future use. --- .../Pdf/BurnPdfCommand.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs b/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs index 1bc9398b..c15c853d 100644 --- a/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs +++ b/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs @@ -329,7 +329,23 @@ public class BurnPdfCommandHandler : IRequestHandler private void AddInkAnnotation(int page, string value) { - throw new NotImplementedException(); + var ink = JsonConvert.DeserializeObject(value); + + var oSegments = ink?.Lines.Points; + var oColor = ColorTranslator.FromHtml(ink?.StrokeColor ?? "#000000"); + _manager.SelectPage(page); + + if (oSegments is null) + return; + + foreach (var oSegment in oSegments) + { + var oPoints = oSegment + .Select(ToPointF) + .ToArray(); + + _manager.AddFreeHandAnnot(oColor, oPoints); + } } private void AddInkAnnotation(Annotation pAnnotation)