PDFiumPas Docs API reference

FPdfRedactionMuPdf

Since v3.317.0, this Enterprise unit supplies an optional color-managed source rasterizer for complete-composition redaction

The default native path is unchanged; explicitly set RasterizeCompositePages=True, PreserveTaggedStructure=False and CompositeRasterizer to select the alternative source renderer

Supply the bridge built from Native/CompositeRaster and its matching MuPDF SDK/runtime under a suitable separate license; PDFiumPas does not bundle or download that dependency

ProviderOptions := TPdfMuPdfCompositeOptions.Default;
Options := TPdfRedactionOptions.Default;
Options.RasterizeCompositePages := True;
Options.PreserveTaggedStructure := False;
Options.CompositeRasterizer := CreatePdfMuPdfCompositeRasterizer(
  BridgePath, ProviderOptions);
if not Pdf.SaveAsRedacted(OutputStream, Options, Report) then
  raise Exception.Create(Report.ErrorMessage);

Color and saved output

The bridge enables ICC processing and renders complete page content and annotation appearances on opaque white before redaction; ICC Gray/RGB/CMYK groups, CalRGB, DefaultRGB, nested/knockout/Luminosity compositions and rotated/cropped physical units have focused saved-output coverage

Source content and semantic resources still disappear into the fresh raster document; only final pixels and validated geometry are retained, with cumulative source-raster, final-output and verification work limits

UsedCompositeRasterizer identifies successful source-raster conversion through the selected provider; final saved-byte verification compares the provider's source image with the ordinary native rendering of the fresh output outside the redaction rectangles and the existing one-pixel halo

The qualified RGB gamma/primary counterexample meets the unchanged two-level independent arithmetic bound; source-versus-output comparisons using the same alternative engine establish roundtrip fidelity, not independent correctness for every color profile, and an independent analytic derivation for Gray/CMYK, CalGray/CalRGB/Lab and DefaultGray/DefaultRGB/DefaultCMYK composition remains open, so those spaces are not claimed color-metrically qualified

Limits and lifetime

MaxInputBytes and MaxRasterBytes default to 268435456 each; StoreBytes defaults to 67108864 and controls the engine cache rather than all native allocation

The bridge owns source bytes and a separate context per transaction, keeps native exceptions inside C and pins its module until all document sessions close; the source stream position is restored after opening

Rendering is synchronous and sessions must not be used concurrently; these byte/cache limits do not provide hard allocation limits, noncooperative cancellation or process isolation

Ordinary and older bridge builds retain custom soft-mask transfer rejection; since v3.318.0, an explicit PDFC_MUPDF_SOURCE_DIR build with the exact licensed 1.28.5 sources restores persistent soft-mask TR state and nonzero TR(0) outside Alpha-mask G bounds

The source preparer accepts MuPDF 1.28.5 and 1.29.0, verifies exact source identities, leaves SDK inputs unchanged and injects both the persistent soft-mask state and the graphics transfer support into the generated processor; the bridge advertises PdfRedactionCompositeSoftMaskTransfer and PdfRedactionCompositeTransferFunctions through IPdfRedactionCompositeCapabilities only for that corrected build

From internal version 3.384.0, /TR and /TR2 map the colour components of paths, text, images and axial or radial shadings; a four-function array selects red, green, blue and the gray slot, /TR2 takes precedence over /TR, and Identity or Default stays a no-op; a transferred colour composited with a constant alpha stays within one byte level of the analytic straight-alpha expectation, which is separate from the retained soft-mask transfer and constant-alpha disagreement

Component mapping happens in each object's colour space, so DeviceGray and DeviceRGB reproduce the device-space arithmetic of ISO 32000-1 10.4 exactly, while calibrated, separation and DeviceN spaces are mapped before conversion and are not claimed colour-metrically; Type3 glyph programs, mesh shadings, shading types other than axial and radial, and images or shadings whose colour space holds more than four components fail rather than render unqualified colors

Graphics-state resources are classified independently of mask-like extra keys, and renderer-reported content errors or incomplete data fail without publication

Since v3.318.1, rebuilding the corrected optional bridge adds nearest-byte opacity and soft-mask transfer quantization; all 42 declared mask/paint profiles meet the unchanged two-level continuous-arithmetic criterion, with a maximum observed error about 1.84

The seven v3.318.0 failures retain identical source PDF bytes and expected arrays; checks also cover path/stroke, color/stencil images, axial shading, fill/stroke text, group opacity, Alpha endpoints, physical units and rotations, plus 1024 numeric vectors across the eight opacity callbacks and transfer evaluation

This finite matrix does not certify every color domain or nested composition; the broader color gate remains open

Signed sources, AcroForm/XFA, retained text/vector/tag semantics and resolution-independent appearance guarantees remain outside this strategy

The representative qualification uses MuPDF 1.28.5 with an MSVC x64 bridge, Delphi and checked FPC Win64; other runtime/compiler/platform combinations require separate ABI and output qualification

Provider contract

IPdfRedactionCompositeRasterizer.OpenDocument opens a transaction-local IPdfRedactionCompositeDocument; GetPageCount must match the source, and RenderPage accepts one-based page numbers and exact physical raster dimensions

Return packed top-down BGRA with exactly Width*Height*4 bytes, Alpha 255, complete CropBox coverage, intrinsic rotation and annotation appearances on white; malformed buffers, transparency, failed rendering and page-count mismatches reject without publishing destination bytes