Add AnnotationDto and AnnotationService for API integration
Added `AnnotationDto` to represent signature annotation positions, including properties for ID, page, and coordinates, with detailed documentation on coordinate systems. Implemented `AnnotationService` to fetch annotation data from an API endpoint, using `HttpClient` and supporting cancellation tokens. Registered `AnnotationService` in the DI container to enable its use across the application. Provided development setup details for working with fake data via YARP-proxied routes.
This commit is contained in:
29
EnvelopeGenerator.ReceiverUI/Models/AnnotationDto.cs
Normal file
29
EnvelopeGenerator.ReceiverUI/Models/AnnotationDto.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
namespace EnvelopeGenerator.ReceiverUI.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a pre-assigned signature annotation position on a specific page.
|
||||
/// <br/><br/>
|
||||
/// <b>Coordinate unit (X, Y):</b> Hundredths of an inch (1/100 inch ? 2.83 PDF points),
|
||||
/// origin at the <b>top-left</b> corner of the page, both axes increase downward/rightward.
|
||||
/// This matches the DevExpress XtraReports coordinate system (<see cref="System.Drawing.RectangleF"/>).
|
||||
/// <br/><br/>
|
||||
/// <b>Difference from PSPDFKit:</b> Same origin (top-left) and direction, but PSPDFKit uses PDF points (1/72 inch).
|
||||
/// Convert: <c>xDX = xPsPdf * (100.0 / 72.0)</c>
|
||||
/// <br/>
|
||||
/// <b>Difference from GDPicture:</b> GDPicture uses PDF points with <b>bottom-left</b> origin (PDF standard); Y is flipped.
|
||||
/// Convert: <c>yDX = (pageHeightPt - yGD - elemHeightPt) * (100.0 / 72.0)</c>
|
||||
/// </summary>
|
||||
public record AnnotationDto
|
||||
{
|
||||
/// <summary>Unique identifier of the annotation.</summary>
|
||||
public long Id { get; init; }
|
||||
|
||||
/// <summary>1-based page number within the document.</summary>
|
||||
public int? Page { get; init; }
|
||||
|
||||
/// <summary>Horizontal position in hundredths of an inch from the left edge of the page.</summary>
|
||||
public double? X { get; init; }
|
||||
|
||||
/// <summary>Vertical position in hundredths of an inch from the top edge of the page.</summary>
|
||||
public double? Y { get; init; }
|
||||
}
|
||||
Reference in New Issue
Block a user