Skip to content
getnextpdf.com

Enterprise edition

Document E-Filing — Deep Reference

  • EFilingOptimizer prepares a PDF for electronic court filing in one fixed-order pass: sanitize, linearize, size-split.
  • EFilingProfile encodes jurisdiction constraints. Built-in factories cover US PACER, EU e-Justice, and Taiwan Judicial Yuan.
  • SizeAwareSplitter enforces 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.

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.

Terminal window
composer require nextpdf/enterprise:^3
SymbolParametersDefault behaviorReturnsThrows or fails withNotes
EFilingOptimizer::optimize()string $pdfData, ?EFilingProfile $profile = nullProfile defaults to EFilingProfile::pacer(); runs sanitize, linearize, size-split in fixed orderEFilingResultInvalidArgumentException from the split step when an over-limit input is not a valid PDF; sanitization and linearization failures degrade to warningsOutput is a delivery artifact
EFilingProfile::__construct()$name, $maxFileSizeBytes = 26_214_400, $flattenForms = true, $removeJavaScript = true, $imageQuality = 75, $linearize = true, $compressObjectStreams = trueImmutable jurisdiction profileEFilingProfileDoes not throwCustom caps for portals without a built-in factory
EFilingProfile::pacer()none25 MiB cap, image quality 75EFilingProfileDoes not throwUS PACER
EFilingProfile::euJustice()none10 MiB cap, image quality 70EFilingProfileDoes not throwEU e-Justice Portal
EFilingProfile::taiwan()none10 MiB cap, image quality 70EFilingProfileDoes not throwTaiwan Judicial Yuan
SizeAwareSplitter::splitByMaxSize()string $pdfData, int $maxBytesSingle segment when input fits; otherwise estimate, verify, re-splitlist<EFilingSegment>InvalidArgumentException when an over-limit input lacks a %PDF headerUnder-limit input returns as one segment without validation
EFilingResult::isSplit()nonetrue when more than one segment existsboolDoes not throw
EFilingResult::segmentCount()noneTotal number of segmentsintDoes not throw
EFilingResult::compressionRatio()noneoptimizedTotalSize / originalSizefloatDoes not throw; 0.0 for empty original inputLower is better
EFilingSegment$pdfData, $pageRange, $sizeBytes, $segmentIndexImmutable output segmentvalue objectDoes not throwPage range string such as 1-25 or all
public function optimize(string $pdfData, ?EFilingProfile $profile = null): EFilingResult
public 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(): self
public static function euJustice(): self
public static function taiwan(): self
public function splitByMaxSize(string $pdfData, int $maxBytes): array
public function __construct(
public array $segments,
public int $originalSize,
public int $optimizedTotalSize,
public array $optimizations = [],
public array $warnings = [],
) {}
public function isSplit(): bool
public function segmentCount(): int
public function compressionRatio(): float

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.

  • 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 sizeBytes against the profile cap before filing.
  • Re-split depth cap reached: the over-limit segment passes through unchanged rather than looping.
  • compressionRatio() returns 0.0 when the original input is empty.
  • The module performs no cryptographic operations; FIPS mode is not applicable.
BehaviorReferenceStatus
Linearized output organization (first-page data at file start)ISO 32000-2:2020 Annex F / Annex GBuilt against
Associated-file relationship semanticsISO 19005-3:2012 §6.7.8Honored where carriers apply
Embedded-file carrier requirementsISO 19005-4:2020 Annex AHonored 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.

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->warnings before 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 sizeBytes against the profile cap. An indivisible over-limit page reaches the output silently.
  • For portals without a built-in factory, construct a custom EFilingProfile with the portal’s published cap.

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.