fix(BurnPdfCommand): improve JSON serialization and null safety in Signature entity and BurnPdfCommandHandler

- Added System.Text.Json.Serialization namespace and [JsonIgnore] attributes to Top and Left properties in Signature entity for .NET builds
- Applied null-forgiving operator (!) and null-coalescing defaults for frame.X and frame.Y in BurnPdfCommandHandler
- Improved runtime safety and prevented unintended JSON serialization of computed properties
This commit is contained in:
2025-11-07 09:51:02 +01:00
parent 15f6ee7be0
commit 6a5c9a3489
3 changed files with 18 additions and 6 deletions

View File

@@ -43,6 +43,13 @@ public class BurnPdfCommandHandler : IRequestHandler<BurnPdfCommand>
_signRepo = signRepo;
}
/// <summary>
///
/// </summary>
/// <param name="pSourceBuffer"></param>
/// <param name="pInstantJSONList"></param>
/// <param name="envelopeId"></param>
/// <returns></returns>
public byte[] BurnAnnotsToPDF(byte[] pSourceBuffer, List<string> pInstantJSONList, int envelopeId)
{
// read the elements of envelope with their annotations
@@ -99,10 +106,10 @@ public class BurnPdfCommandHandler : IRequestHandler<BurnPdfCommand>
var frame = element.Annotations?.FirstOrDefault(a => a.Name == "frame");
double frameY = element.Top - 0.5 - margin;
double frameYShift = frame.Y - frameY * inchFactor;
double frameXShift = frame.X - frameX * inchFactor;
double frameYShift = (frame!.Y ?? default) - frameY * inchFactor;
double frameXShift = (frame.X ?? default) - frameX * inchFactor;
foreach (var annot in element.Annotations)
foreach (var annot in element.Annotations!)
{
double yOffsetofFF;
if (!yOffsetsOfFF.TryGetValue(annot.Name, out yOffsetofFF))