From 522de8a86389441355d1d3b054bd0e597fb38069 Mon Sep 17 00:00:00 2001 From: TekH Date: Tue, 21 Jul 2026 10:20:18 +0200 Subject: [PATCH] feat: Add IPdfProcessor.MergePdfsAsync interface - Add MergePdfsAsync method to IPdfProcessor interface - Parameters: IReadOnlyList pdfStreams, IReadOnlyList? pageRanges - Returns: Task (merged PDF) - Validates: Minimum 2 PDFs, stream Position = 0, page ranges count matches PDF count - Supports optional page ranges (e.g., '1-3,5' or null for all pages) --- .../Common/Interfaces/IPdfProcessor.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/DocumentOperator.Application/Common/Interfaces/IPdfProcessor.cs b/DocumentOperator.Application/Common/Interfaces/IPdfProcessor.cs index dc914ce..667c07b 100644 --- a/DocumentOperator.Application/Common/Interfaces/IPdfProcessor.cs +++ b/DocumentOperator.Application/Common/Interfaces/IPdfProcessor.cs @@ -58,4 +58,22 @@ public interface IPdfProcessor /// Thrown when PDF contains no attachments /// Task ExtractAttachmentsAsync(Stream pdfStream); + + /// + /// Merges multiple PDF documents into a single PDF. + /// + /// + /// PDF streams to merge (minimum 2 required). Each stream must be readable and positioned + /// at the beginning (Position = 0). Caller is responsible for disposal. + /// + /// + /// Optional page ranges per PDF (null = all pages). Format: "1-3,5" means pages 1, 2, 3, and 5. + /// If null or empty for a PDF, all pages are included. Array length must match pdfStreams length if provided. + /// + /// Merged PDF as byte array + /// + /// Thrown when fewer than 2 PDFs provided, any stream is empty/invalid/not at Position=0, + /// or page range format is invalid + /// + Task MergePdfsAsync(IReadOnlyList pdfStreams, IReadOnlyList? pageRanges = null); } \ No newline at end of file