using DigitalData.Core.Exceptions; using EnvelopeGenerator.Application.Common.Dto; using EnvelopeGenerator.Domain.Interfaces; namespace EnvelopeGenerator.Application.Common.Interfaces.Doc; /// /// /// public interface IPdfPageImageRenderer { /// /// /// /// /// /// Task> RenderPagesAsImagesAsync(byte[] pdfBytes, CancellationToken cancellationToken = default); /// /// /// /// /// byte[] ComposeSignaturePreviewPng(ISignatureInkPayload element); /// /// /// /// /// public bool IsSupportedImageFormat(byte[] bytes); } /// /// /// public static class PdfPageImageRendererExtensions { /// /// /// /// /// /// /// public static byte[] EnsureSupportedImageBytes(this IPdfPageImageRenderer renderer, byte[] inkBytes) { if (!renderer.IsSupportedImageFormat(inkBytes)) throw new BadRequestException("Only PNG and JPEG signature formats are supported."); return inkBytes; } }