Enterprise edition
Document E-Filing — Deep Reference
At a glance
Section titled “At a glance”EFilingOptimizerprepares a PDF for electronic court filing in one fixed-order pass: sanitize, linearize, size-split.EFilingProfileencodes jurisdiction constraints. Built-in factories cover US PACER, EU e-Justice, and Taiwan Judicial Yuan.SizeAwareSplitterenforces a per-segment byte cap with verify-then-correct re-splitting.- Output is a delivery artifact. It must not re-enter signing or archival pipelines.
- The module performs no cryptographic operations and makes no outbound network calls.
Availability & licensing
Section titled “Availability & licensing”This capability ships in NextPDF Enterprise (nextpdf/enterprise) and activates with an Enterprise-tier license envelope. A deployment without that entitlement does not load the capability’s classes. Compare editions and get a license.
The nextpdf/enterprise package boundary gates this surface; there is no separate per-feature capability code. No Core or Pro edition provides an e-filing optimizer.
Public API surface
Section titled “Public API surface”composer require nextpdf/enterprise:^3| Symbol | Parameters | Default behavior | Returns | Throws or fails with | Notes |
|---|---|---|---|---|---|
EFilingOptimizer::optimize() | string $pdfData, ?EFilingProfile $profile = null | Profile defaults to EFilingProfile::pacer(); runs sanitize, linearize, size-split in fixed order | EFilingResult | InvalidArgumentException from the split step when an over-limit input is not a valid PDF; sanitization and linearization failures degrade to warnings | Output is a delivery artifact |
EFilingProfile::__construct() | $name, $maxFileSizeBytes = 26_214_400, $flattenForms = true, $removeJavaScript = true, $imageQuality = 75, $linearize = true, $compressObjectStreams = true | Immutable jurisdiction profile | EFilingProfile | Does not throw | Custom caps for portals without a built-in factory |
EFilingProfile::pacer() | none | 25 MiB cap, image quality 75 | EFilingProfile | Does not throw | US PACER |
EFilingProfile::euJustice() | none | 10 MiB cap, image quality 70 | EFilingProfile | Does not throw | EU e-Justice Portal |
EFilingProfile::taiwan() | none | 10 MiB cap, image quality 70 | EFilingProfile | Does not throw | Taiwan Judicial Yuan |
SizeAwareSplitter::splitByMaxSize() | string $pdfData, int $maxBytes | Single segment when input fits; otherwise estimate, verify, re-split | list<EFilingSegment> | InvalidArgumentException when an over-limit input lacks a %PDF header | Under-limit input returns as one segment without validation |
EFilingResult::isSplit() | none | true when more than one segment exists | bool | Does not throw | — |
EFilingResult::segmentCount() | none | Total number of segments | int | Does not throw | — |
EFilingResult::compressionRatio() | none | optimizedTotalSize / originalSize | float | Does not throw; 0.0 for empty original input | Lower is better |
EFilingSegment | $pdfData, $pageRange, $sizeBytes, $segmentIndex | Immutable output segment | value object | Does not throw | Page range string such as 1-25 or all |
public function optimize(string $pdfData, ?EFilingProfile $profile = null): EFilingResultpublic function __construct( public string $name, public int $maxFileSizeBytes = 26_214_400, public bool $flattenForms = true, public bool $removeJavaScript = true, public int $imageQuality = 75, public bool $linearize = true, public bool $compressObjectStreams = true,) {}
public static function pacer(): selfpublic static function euJustice(): selfpublic static function taiwan(): selfpublic function splitByMaxSize(string $pdfData, int $maxBytes): arraypublic function __construct( public array $segments, public int $originalSize, public int $optimizedTotalSize, public array $optimizations = [], public array $warnings = [],) {}
public function isSplit(): boolpublic function segmentCount(): intpublic function compressionRatio(): floatBehavior contract
Section titled “Behavior contract”EFilingOptimizer::optimize() runs a fixed-order pipeline against the input bytes. Step one removes active content when removeJavaScript is set. It delegates to the content-disarm-and-reconstruction engine with a filing-specific policy: JavaScript, named JavaScript, launch actions, form submission, and data-import actions are removed; URI actions are kept (allowUriActions) because filings may carry legitimate links; incremental updates are flattened into one revision (flattenIncrementalUpdates). Step two linearizes the sanitized bytes through the Core NextPDF\Writer\Linearizer when linearize is set. Step three enforces the profile’s maxFileSizeBytes through SizeAwareSplitter.
The splitter estimates pages per segment from the average page size, splits, then verifies every produced segment against the cap. Any over-limit segment that still spans more than one page is re-split recursively, halving its own page span each pass, until every child fits or is a single page. A bounded re-split depth guards against pathological non-convergence. Output indices are re-normalized to stay contiguous and zero-based.
optimize() consumes three profile fields: maxFileSizeBytes, removeJavaScript, and linearize. The flattenForms, imageQuality, and compressObjectStreams fields are declared profile constraints that optimize() does not act on in 3.1.0.
E-filing output is a delivery artifact, not a document-lifecycle state. An optimized or split PDF is final for transmission and must not re-enter a signing or archival pipeline; re-processing would break hash chains and evidentiary integrity.
This module prepares formats for e-court / government filing as configured. Built-in profile caps encode commonly published constraints as a convenience; portal rules vary by jurisdiction and change. Verifying them against the destination registry’s current rules is the filer’s responsibility.
Processing is in-process and local. Transport to a court, registry, or filing portal is external to this module.
Edge cases & failure modes
Section titled “Edge cases & failure modes”- Input at or under the cap: one segment with page range
all; the split step leaves the bytes unchanged. - Sanitization rejection (for example an unparseable input): the warning
CDR sanitization rejected: <reason>is recorded and the pipeline continues with the original bytes. - Sanitization pass with no threats found: the bytes are still replaced by the rebuilt PDF, and an optimization entry records the clean pass.
- Linearization failure: the warning
Linearization skipped: <message>is recorded and the pipeline continues with unlinearized bytes. - Single page over the cap: genuinely indivisible, returned unchanged as one over-limit segment. No warning is recorded for this case; compare each segment’s
sizeBytesagainst the profile cap before filing. - Re-split depth cap reached: the over-limit segment passes through unchanged rather than looping.
compressionRatio()returns0.0when the original input is empty.- The module performs no cryptographic operations; FIPS mode is not applicable.
Conformance
Section titled “Conformance”| Behavior | Reference | Status |
|---|---|---|
| Linearized output organization (first-page data at file start) | ISO 32000-2:2020 Annex F / Annex G | Built against |
| Associated-file relationship semantics | ISO 19005-3:2012 §6.7.8 | Honored where carriers apply |
| Embedded-file carrier requirements | ISO 19005-4:2020 Annex A | Honored where carriers apply |
Linearization targets the Linearized PDF organization, which places all data required to display the first page at the beginning of the file for efficient incremental access.
These rows describe capability built against the cited clauses.
Filing rules vary by jurisdiction and change; meeting them is the filer’s responsibility. Consult counsel and the destination registry’s current guidance.
Development notes
Section titled “Development notes”use NextPDF\Enterprise\Document\EFiling\EFilingOptimizer;use NextPDF\Enterprise\Document\EFiling\EFilingProfile;
$optimizer = new EFilingOptimizer();$result = $optimizer->optimize($pdfBytes, EFilingProfile::euJustice());
foreach ($result->segments as $segment) { // Persist $segment->pdfData; confirm $segment->sizeBytes fits the cap.}- Inspect
$result->warningsbefore filing. A rejected sanitization or skipped linearization surfaces there, not as an exception. - Sign and archive the source document first; then optimize a copy for delivery. Never re-sign, re-stamp, or archive an optimized segment.
- Verify every segment’s
sizeBytesagainst the profile cap. An indivisible over-limit page reaches the output silently. - For portals without a built-in factory, construct a custom
EFilingProfilewith the portal’s published cap.
Publication boundary
Section titled “Publication boundary”This page documents externally observable behavior and the supported public API surface only. Internal namespace paths, helper classes, mechanism tables, runbook filenames, and ticket prefixes are out of scope.