Two bundle families — Read and Read+Write — across the four size segments.

This page is a reference page for the committed dist/ build, not a module page: no descriptor is named dist-matrix.

Generated by packages/front/office/pdf/tools/generate-bundles.mjs | Surfaces dist/build/ (fw-mode) + dist/standalone/ (framework-free) | Since 2026-08-04

The committed build is a matrix of two independent axes:

  • size segmentation (frozen): pdf (bare core), pdf-large, pdf-full, pdf-legacy — the extras layered on top of the core;
  • capability family (this page): Read and Read+Write.

Both axes cross with the two path-discriminated surfaces (dist/build/ and dist/standalone/), so every cell ships a .js / .min.js / .meta.json triplet: 8 roots × 2 surfaces × 3 files = 48 files, plus the single dist/build/index.js fw-mode barrel.

Naming scheme

The discriminator is a trailing -rw segment on the root name; the absence of a discriminator marks the Read family. The four historical root names are frozen — renaming them to pdf-read.js etc. would have removed a published name, which the additive doctrine forbids.

Family Root names Path
Read pdf, pdf-large, pdf-full, pdf-legacy @awacloud/pdf/{build,standalone}/<root>.js
Read+Write pdf-rw, pdf-large-rw, pdf-full-rw, pdf-legacy-rw @awacloud/pdf/{build,standalone}/<root>.js

Generated export names follow the surface suffix already in force: pdfRwBundled / pdfRwPackage, pdfLargeRwBundled / pdfLargeRwPackage, and so on.

The matrix

Module counts are the meta.json modules closure. A Read root lists the same closure on both surfaces. A Read+Write root does not: its standalone closure inlines 14 @awacloud/fonts modules (the Standard 14 and encoding lookups pdfBuilder uses, their tables and fontErrors), which its build closure leaves out because it declares them instead (What a consumer registers).

Segment Read root modules Read+Write root modules, standalone modules, build
bare core pdf 27 pdf-rw 53 39
large pdf-large 49 pdf-large-rw 75 61
full pdf-full 56 pdf-full-rw 82 68
legacy pdf-legacy 60 pdf-legacy-rw 86 72

The composition is strictly additive: every Read root is a subset of its Read+Write twin on each surface, and adding the Read+Write family left the four Read roots unchanged.

What a consumer registers

Each surface states what it needs at runtime, per family:

Surface Family Register on the @awacloud/fw runtime
dist/standalone/ Read and Read+Write nothing: factory() takes no argument
dist/build/ Read the @awacloud/fw modules of fw_require
dist/build/ Read+Write fw_require, and @awacloud/fonts' manifest (its fw_require and modules, which is pdf's pkg_require)

A dist/build Read+Write root declares, after the fw_require names, the two @awacloud/fonts modules it uses, standard14Lookup and encodingLookup, and inlines neither them nor their tables; its .meta.json names them under siblingDependencies ({ modules, package: "@awacloud/fonts" }), and its fwDependencies keeps the fw names only. Resolving it on a runtime without fonts' manifest throws the runtime's Module not found: standard14Lookup. The dist/standalone roots inline the same modules and need nothing.

import { ModuleRuntime } from '@awacloud/fw/core/runtime.js';
import { fw_require, pkg_require } from '@awacloud/pdf';
import { pdfRwPackage } from '@awacloud/pdf/build/pdf-rw.js';

const rt = new ModuleRuntime();
rt.registerAll(fw_require);
rt.registerAll(pkg_require);        // @awacloud/fonts' manifest
rt.register(pdfRwPackage);

const core = rt.resolve('pdfRwPackage');
const bytes = core.pdfBuilder.builder()
    .addPage()
    .addFont({ name: 'F1', baseFont: 'Helvetica' })   // Widths + FontDescriptor
    .build();

Measured effect of the boundary on the dist/build Read+Write roots: about 32.6 KB less minified each (pdf-rw.min.js 226,956 → 194,324 bytes, pdf-legacy-rw.min.js 377,190 → 344,582) and 60.9 KB less unminified.

Write inventory

The Read+Write delta is the write inventory — the write-path modules that are separable from the pdf orchestrator core — plus the verification surface:

Module Surface In every -rw root
pdfBuilder builder() yes
pdfIncrementalWriter appendIncremental() yes
pdfXrefStreamWriter writeXrefStreamDocument() yes (required in every -rw root)
pdfEncryptedWriter writeEncryptedDocument() yes
pdfSign sign() yes
pdfDssBuilder buildDss() yes (transitive via pdfSign)

Their closure also pulls in pdfFlate, pdfAesGcm, pdfStandardV4/V5/V6, pdfSigOids, pdfByteRange, pdfSha1 — all classified shared (each exposes both directions, e.g. encode/decode, encryptStream/ decryptStream).

Two documented exclusions

  • pdfSerializer and pdfWriter are core-embedded. They are write-path (serializeObject, writeDocument) but are declared dependencies of src/pdf.js itself — pdf.write() is part of the core facade. They cannot be factored out without changing src/pdf.js, so they are not part of the composable inventory and the Read-family purity lock is stated against the six modules above.
  • pdfFontEmbed is write-path but not shippable in a bundle. Its four declared dependencies (embedSubsetForPdf, embedFontDescriptor, embedCidSystemInfo, embedToUnicodeBuilder) come from pkg_require (@awacloud/fonts), which the generator's local registry (buildLocalRegistry(modules, extras)) does not see — including it makes topoLocal throw Unknown module : embedSubsetForPdf. Font embedding therefore stays an fw-runtime-only capability.

Verification surface

A bundle that can sign() can also verify: every -rw root ships the read-path signature verifier beside the signer.

Module Surface In every -rw root In a Read root
pdfSignature verifySignature(), verifyAllSignatures() yes no

pdfSignature is a read module, not part of the write inventory; the generator lists it separately (VERIFY_SURFACE in tools/generate-bundles.mjs) so the inventory above stays exactly the set of separable write modules.

It rides the Read+Write family, not the Read family, because the four Read roots are byte-frozen: adding it left them, their .meta.json and the dist/build/index.js barrel byte-identical. Its crypto closure already ships through pdfSign, so it adds no @awacloud/fw dependency and no other module — only pdfSignature itself joins each -rw closure. Measured cost per -rw root: +21.8 KB minified (for example build/pdf-rw.min.js 121,323 → 143,156 bytes, +18.0 %; standalone/pdf-legacy-rw.min.js 336,801 → 358,735 bytes, +6.5 %) and +6.4 KB after gzip -9.

An invoked -rw factory exposes the verifier on the returned core:

import { pdfRwBundled } from '@awacloud/pdf/standalone/pdf-rw.js';

const core = pdfRwBundled.factory();
core.usedExtension('pdfSignature');          // → true
const { signatures, timestamps } = core.pdfSignature.verifyAllSignatures(bytes);

Module classification

All 95 src/main.js#modules factories were classified from their resolved API (a fresh ModuleRuntime per module — the shared pdf singleton order-poisons Object.keys):

Class Count Rule
read 68 the returned API only parses, types, walks or verifies existing bytes
write 9 the returned API emits or assembles PDF output
shared 18 the returned API works both directions, or is a pure table/primitive

The per-module table is the composition's contract; it is kept in the source monorepo and is not published. The write and verification modules it selects are listed above.

Notes

  • The Read+Write family is a dist/ composition only. Its four bundle plan entries live in tools/generate-bundles.mjs, not in src/main.js#bundle, so runtime.resolve('pdfRwBundle') is not a supported call. On an @awacloud/fw runtime, register the write modules from the modules array (or the dist/build/index.js barrel) directly.
  • Invocability. Every dist/standalone root is invocable with no arguments, the layered ones included: the generator wraps each layered entry in the { name, register } envelope that pdf.use() requires, so pdfLargeBundled.factory() or pdfRwBundled.factory() returns a core with its extras registered (core.usedExtension(name)). The dist/build roots need an @awacloud/fw runtime to inject their declared dependencies, @awacloud/fonts' manifest included for the Read+Write roots (What a consumer registers).
  • Regeneration is idempotent: bun run gen:bundles re-emits byte-identical output (no build stamp; every bundle opens with the /*! … */ licence banner at byte 0).

See also