refactor: Change IPdfProcessor interface from byte[] to Stream
- ValidateAsync(byte[]) → ValidateAsync(Stream) - ValidatePdfAAsync(byte[]) → ValidatePdfAAsync(Stream) - CheckAttachmentsAsync(byte[]) → CheckAttachmentsAsync(Stream) - Reason: Stream-based processing reduces memory footprint and enables pipeline parallelization
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using DocumentOperator.Domain.Models.ValueObjects;
|
||||
using DocumentOperator.Application.Common.DTOs;
|
||||
|
||||
namespace DocumentOperator.Application.Common.Interfaces;
|
||||
|
||||
@@ -7,20 +7,30 @@ public interface IPdfProcessor
|
||||
/// <summary>
|
||||
/// Validates a PDF and extracts metadata.
|
||||
/// </summary>
|
||||
/// <param name="pdfBytes">PDF content as byte array</param>
|
||||
/// <param name="pdfStream">PDF content as stream (caller is responsible for disposal)</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 cref="Domain.Common.Exceptions.BadRequestException">
|
||||
/// Thrown when stream is empty or invalid
|
||||
/// </exception>
|
||||
Task<PdfMetadata> ValidateAsync(byte[] pdfBytes);
|
||||
Task<PdfMetadata> ValidateAsync(Stream pdfStream);
|
||||
|
||||
/// <summary>
|
||||
/// Validates a PDF/A document and checks conformance level.
|
||||
/// </summary>
|
||||
/// <param name="pdfBytes">PDF content as byte array</param>
|
||||
/// <param name="pdfStream">PDF content as stream (caller is responsible for disposal)</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 cref="Domain.Common.Exceptions.BadRequestException">
|
||||
/// Thrown when stream is empty or invalid
|
||||
/// </exception>
|
||||
Task<PdfAMetadata> ValidatePdfAAsync(byte[] pdfBytes);
|
||||
Task<PdfAMetadata> ValidatePdfAAsync(Stream pdfStream);
|
||||
|
||||
/// <summary>
|
||||
/// Checks for embedded files (attachments) in a PDF document and returns detailed metadata.
|
||||
/// </summary>
|
||||
/// <param name="pdfStream">PDF content as stream (caller is responsible for disposal)</param>
|
||||
/// <returns>Attachment information (count, file names, MIME types, sizes)</returns>
|
||||
/// <exception cref="Domain.Common.Exceptions.BadRequestException">
|
||||
/// Thrown when stream is empty or invalid
|
||||
/// </exception>
|
||||
Task<AttachmentInfo> CheckAttachmentsAsync(Stream pdfStream);
|
||||
}
|
||||
Reference in New Issue
Block a user