Domain layer: - PdfAMetadata value object (isValid, pdfVersion, pageCount, encrypted, pdfaVersion, pdfaCompliant, errors, warnings) Infrastructure layer: - IPdfProcessor.ValidatePdfAAsync() interface method - DevExpressPdfProcessor.ValidatePdfAAsync() implementation - DetectEncryption() - scans PDF raw data for /Encrypt keyword - DetectPdfAConformance() - parses XMP metadata (pdfaid:part, pdfaid:conformance) - Validation: encrypted PDF cannot be PDF/A compliant Application layer: - ValidatePdfAQuery + ValidatePdfAQueryHandler (co-located) - ValidatePdfAQueryValidator (FluentValidation: PdfBytes XOR Base64Pdf) - PdfAValidationResult DTO - AutoMapper: PdfAMetadata -> PdfAValidationResult API layer: - PdfValidationController.ValidatePdfAFromFile() (multipart/form-data) - PdfValidationController.ValidatePdfAFromBase64() (application/json) - XML documentation with response codes Result: - POST /api/pdf/validation/validate-pdfa (both multipart and JSON) - Returns: conformance level, errors, warnings - Build: 0 errors, 4 warnings (DevExpress eval) - Tests: 20/20 passing Next: Integration tests + Swagger test case
26 lines
1.0 KiB
C#
26 lines
1.0 KiB
C#
using DocumentOperator.Domain.Models.ValueObjects;
|
|
|
|
namespace DocumentOperator.Application.Common.Interfaces;
|
|
|
|
public interface IPdfProcessor
|
|
{
|
|
/// <summary>
|
|
/// Validates a PDF and extracts metadata.
|
|
/// </summary>
|
|
/// <param name="pdfBytes">PDF content as byte array</param>
|
|
/// <returns>PDF metadata (page count, size, version, attachments)</returns>
|
|
/// <exception cref="Domain.Common.Exceptions.PdfProcessingException">
|
|
/// Thrown when PDF is corrupted or cannot be processed
|
|
/// </exception>
|
|
Task<PdfMetadata> ValidateAsync(byte[] pdfBytes);
|
|
|
|
/// <summary>
|
|
/// Validates a PDF/A document and checks conformance level.
|
|
/// </summary>
|
|
/// <param name="pdfBytes">PDF content as byte array</param>
|
|
/// <returns>PDF/A metadata including conformance level and validation errors/warnings</returns>
|
|
/// <exception cref="Domain.Common.Exceptions.PdfProcessingException">
|
|
/// Thrown when PDF is corrupted or cannot be processed
|
|
/// </exception>
|
|
Task<PdfAMetadata> ValidatePdfAAsync(byte[] pdfBytes);
|
|
} |