Skip to content

PdfMerger

PdfMerger is the only non-static, instance-based public type in this library. It merges multiple document ranges into a single PDF, always performing the merge itself at no conformance, and applying PDF/A only as an optional post-merge pass whose failure is logged (via the injected ILogService) rather than surfaced to the caller. It is constructed directly by SyncfusionPdfService in the consuming PdfAPI application, not resolved through a dependency-injection container internal to this library.

Purpose

  • Merge a set of document ranges — whole documents or extracted page subsets — into one PDF (BR-SFC-030).
  • Always perform the merge at no conformance, regardless of the caller's PDF/A option (BR-SFC-029).
  • Apply PDF/A as a best-effort post-merge pass whose failure is logged as a warning rather than failing the whole operation (BR-SFC-032).
  • Always report the merge result as succeeded, even when the PDF/A upgrade failed (BR-SFC-033).

Context

  • Namespace: PdfAPI.SyncFusionCore
  • Assembly/package: PdfAPI.SyncFusionCore (Pdf.Local.Client NuGet package)

Public members

Member Signature Purpose
PdfMerger PdfMerger(IEnvironmentService envService, ILogService logService) Constructs the merger with the caller-supplied environment and log services, both from SAIF.Framework.Core, used respectively for diagnostic context and to log a PDF/A upgrade failure.
Merge PdfResult Merge(MergeRequest request, long? trackingId) Executes Merge document ranges into one PDF (OP-SFC-012): merges every DocumentRange in request.DocumentRanges, optionally upgrades the result to PDF/A, and returns a PdfResult stamped Status = Succeeded, PdfProcessorType = Syncfusion, with Elapsed, ImageId (parsed from request.SourceSystemId), and TrackingId.

Behavioral notes

  • Any failure during the initial merge (before the optional PDF/A pass) propagates directly to the caller — there is no surrounding catch for that part of the operation (BR-SFC-028).
  • A failure only in the post-merge PDF/A pass is caught, logged via PdfHelper.GetApplicationDetail and ILogService.LogException, and does not fail the merge; the non-conformant PDF is returned instead (BR-SFC-032).
  • request.SourceSystemId is parsed into ImageId via long.TryParse (BR-SFC-009).

Constraints and usage notes

  • Requires an IEnvironmentService and ILogService (both from SAIF.Framework.Core) to be supplied at construction; there is no parameterless constructor.

Sources

  • PdfApi.SyncFusionCore\Merge\PdfMerger.cs