Introduced multiple interfaces and DTOs to support a wide range of PDF-related operations, including attachment handling, conversion, validation, annotation, stamping, and metadata extraction. Key changes: - Added `DocumentServiceClientOptions` for HTTP client config. - Introduced `IPdfAttachmentClient` for attachment operations. - Added `IPdfConversionClient` for PDF/A conversion (marked obsolete). - Added `IPdfOperationsClient` for merge, annotate, and stamp ops. - Introduced `IPdfValidationClient` for PDF and PDF/A validation. - Added `ISwissQrCodeClient` for Swiss QR Code extraction. - Added `IZugferdClient` for ZUGFeRD detection and extraction. - Created request DTOs for Base64-encoded operations. - Added enums for annotation, stamp, and validation configurations. These changes provide a flexible and extensible foundation for interacting with PDF documents, supporting both multipart and Base64-encoded inputs, and ensuring type safety with enums and records.
222 lines
6.7 KiB
C#
222 lines
6.7 KiB
C#
using DocumentService.Client.Models.ValueObjects;
|
|
|
|
namespace DocumentService.Client.Models.Requests;
|
|
|
|
/// <summary>
|
|
/// Request DTO for Base64-encoded PDF merge operation
|
|
/// </summary>
|
|
public record MergePdfsBase64Request
|
|
{
|
|
/// <summary>
|
|
/// Array of Base64-encoded PDF files (minimum 2 required)
|
|
/// </summary>
|
|
/// <example>["JVBERi0xLjQK...", "JVBERi0xLjQK..."]</example>
|
|
public required List<string> Base64Pdfs { get; init; }
|
|
|
|
/// <summary>
|
|
/// Optional page ranges per PDF (null = all pages).
|
|
/// Format: "1-3,5" means pages 1, 2, 3, and 5.
|
|
/// If provided, array length must match Base64Pdfs length.
|
|
/// </summary>
|
|
/// <example>["1-2", "1,3,5", null]</example>
|
|
public List<string?>? PageRanges { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Request DTO for Base64-encoded PDF annotation
|
|
/// </summary>
|
|
public record AddAnnotationBase64Request
|
|
{
|
|
/// <summary>
|
|
/// Base64-encoded PDF file
|
|
/// </summary>
|
|
/// <example>"JVBERi0xLjQK..."</example>
|
|
public required string Base64Pdf { get; init; }
|
|
|
|
/// <summary>
|
|
/// Type of annotation to add
|
|
/// </summary>
|
|
/// <example>TextMarkup</example>
|
|
public required AnnotationType AnnotationType { get; init; }
|
|
|
|
/// <summary>
|
|
/// Target page number (1-indexed)
|
|
/// </summary>
|
|
/// <example>1</example>
|
|
public required int PageNumber { get; init; }
|
|
|
|
/// <summary>
|
|
/// Rectangle X1 coordinate (left)
|
|
/// </summary>
|
|
/// <example>100.0</example>
|
|
public required double X1 { get; init; }
|
|
|
|
/// <summary>
|
|
/// Rectangle Y1 coordinate (top or bottom depending on Origin)
|
|
/// </summary>
|
|
/// <example>100.0</example>
|
|
public required double Y1 { get; init; }
|
|
|
|
/// <summary>
|
|
/// Rectangle X2 coordinate (right). Optional if Width is provided.
|
|
/// </summary>
|
|
/// <example>200.0</example>
|
|
public double? X2 { get; init; }
|
|
|
|
/// <summary>
|
|
/// Rectangle Y2 coordinate (bottom or top depending on Origin). Optional if Height is provided.
|
|
/// </summary>
|
|
/// <example>120.0</example>
|
|
public double? Y2 { get; init; }
|
|
|
|
/// <summary>
|
|
/// Rectangle width. Alternative to X2 (X2 = X1 + Width). Optional if X2 is provided.
|
|
/// </summary>
|
|
/// <example>100.0</example>
|
|
public double? Width { get; init; }
|
|
|
|
/// <summary>
|
|
/// Rectangle height. Alternative to Y2 (Y2 = Y1 + Height). Optional if Y2 is provided.
|
|
/// </summary>
|
|
/// <example>20.0</example>
|
|
public double? Height { get; init; }
|
|
|
|
/// <summary>
|
|
/// Annotation content (required for FreeText and StickyNote)
|
|
/// </summary>
|
|
/// <example>"Important text to highlight"</example>
|
|
public string? Content { get; init; }
|
|
|
|
/// <summary>
|
|
/// Author name (optional)
|
|
/// </summary>
|
|
/// <example>"John Doe"</example>
|
|
public string? Author { get; init; }
|
|
|
|
/// <summary>
|
|
/// Hex color (6 digits, e.g., "FF0000" for red). Optional - defaults vary by annotation type.
|
|
/// </summary>
|
|
/// <example>"FFFF00"</example>
|
|
public string? Color { get; init; }
|
|
|
|
/// <summary>
|
|
/// Text markup style (Highlight, Underline, or Strikeout). Required for TextMarkup annotations.
|
|
/// </summary>
|
|
/// <example>Highlight</example>
|
|
public TextMarkupStyle? TextMarkupStyle { get; init; }
|
|
|
|
/// <summary>
|
|
/// Coordinate origin (BottomLeft = PDF native, TopLeft = UI-friendly). Default: BottomLeft
|
|
/// </summary>
|
|
/// <example>BottomLeft</example>
|
|
public AnnotationOrigin Origin { get; init; } = AnnotationOrigin.BottomLeft;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Request DTO for Base64-encoded PDF stamp operation
|
|
/// </summary>
|
|
public record AddStampBase64Request
|
|
{
|
|
/// <summary>
|
|
/// Base64-encoded PDF file
|
|
/// </summary>
|
|
/// <example>"JVBERi0xLjQK..."</example>
|
|
public required string Base64Pdf { get; init; }
|
|
|
|
/// <summary>
|
|
/// Type of stamp (Text, Image, or Predefined)
|
|
/// </summary>
|
|
/// <example>Text</example>
|
|
public required StampType StampType { get; init; }
|
|
|
|
/// <summary>
|
|
/// Target page numbers (1-indexed). Null or empty = all pages.
|
|
/// </summary>
|
|
/// <example>[1, 3, 5]</example>
|
|
public int[]? PageNumbers { get; init; }
|
|
|
|
/// <summary>
|
|
/// Stamp position X coordinate
|
|
/// </summary>
|
|
/// <example>100.0</example>
|
|
public required double X { get; init; }
|
|
|
|
/// <summary>
|
|
/// Stamp position Y coordinate
|
|
/// </summary>
|
|
/// <example>100.0</example>
|
|
public required double Y { get; init; }
|
|
|
|
/// <summary>
|
|
/// Stamp width (optional, auto-size for images if not specified)
|
|
/// </summary>
|
|
/// <example>200.0</example>
|
|
public double? Width { get; init; }
|
|
|
|
/// <summary>
|
|
/// Stamp height (optional, auto-size for images if not specified)
|
|
/// </summary>
|
|
/// <example>50.0</example>
|
|
public double? Height { get; init; }
|
|
|
|
/// <summary>
|
|
/// Coordinate origin (BottomLeft = PDF native, TopLeft = UI-friendly). Default: BottomLeft
|
|
/// </summary>
|
|
/// <example>BottomLeft</example>
|
|
public AnnotationOrigin Origin { get; init; } = AnnotationOrigin.BottomLeft;
|
|
|
|
/// <summary>
|
|
/// Text content (required for Text stamps)
|
|
/// </summary>
|
|
/// <example>"CONFIDENTIAL"</example>
|
|
public string? Text { get; init; }
|
|
|
|
/// <summary>
|
|
/// Font name (default: Arial)
|
|
/// </summary>
|
|
/// <example>"Arial"</example>
|
|
public string? FontName { get; init; }
|
|
|
|
/// <summary>
|
|
/// Font size in points (default: 12)
|
|
/// </summary>
|
|
/// <example>24.0</example>
|
|
public double? FontSize { get; init; }
|
|
|
|
/// <summary>
|
|
/// Hex color (6 digits, e.g., "FF0000" for red, default: "000000")
|
|
/// </summary>
|
|
/// <example>"FF0000"</example>
|
|
public string? Color { get; init; }
|
|
|
|
/// <summary>
|
|
/// Opacity (0.0 = transparent, 1.0 = opaque, default: 0.5)
|
|
/// </summary>
|
|
/// <example>0.5</example>
|
|
public double? Opacity { get; init; }
|
|
|
|
/// <summary>
|
|
/// Rotation angle in degrees (0-360, default: 0)
|
|
/// </summary>
|
|
/// <example>45.0</example>
|
|
public double? Rotation { get; init; }
|
|
|
|
/// <summary>
|
|
/// Stamp placement (Foreground = on top, Background = watermark effect, default: Foreground)
|
|
/// </summary>
|
|
/// <example>Foreground</example>
|
|
public StampPlacement Placement { get; init; } = StampPlacement.Foreground;
|
|
|
|
/// <summary>
|
|
/// Base64-encoded image (required for Image stamps, PNG/JPEG)
|
|
/// </summary>
|
|
/// <example>"iVBORw0KGgoAAAANSUhEUgAA..."</example>
|
|
public string? Base64Image { get; init; }
|
|
|
|
/// <summary>
|
|
/// Predefined stamp type (required for Predefined stamps)
|
|
/// </summary>
|
|
/// <example>Confidential</example>
|
|
public PredefinedStampType? PredefinedType { get; init; }
|
|
}
|