modern-pdf-lib 0.14.1 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -5
- package/dist/bridge-C7U4E7St.mjs +103 -0
- package/dist/bridge-DUcJFVsk.cjs +132 -0
- package/dist/index.cjs +845 -30
- package/dist/index.d.cts +486 -12
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +486 -12
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +833 -31
- package/dist/{libdeflateWasm-DlHgU5oy.mjs → libdeflateWasm-82loOtIV.mjs} +2 -2
- package/dist/{libdeflateWasm-OkNoqBnO.cjs → libdeflateWasm-Enus0G1k.cjs} +2 -2
- package/dist/{loader-CQfoGFp9.mjs → loader-1VJXLlMZ.mjs} +3 -2
- package/dist/{loader-_fqS-TmT.cjs → loader-CKlBOHma.cjs} +3 -2
- package/dist/{pngEmbed-OYyOe_W0.cjs → pngEmbed-10m4CfBU.cjs} +2 -2
- package/dist/{pngEmbed-DTOqgEUC.mjs → pngEmbed-gaJ9S2Dk.mjs} +2 -2
- package/package.json +4 -1
package/dist/index.d.cts
CHANGED
|
@@ -8306,23 +8306,84 @@ declare function validatePdfA(pdfBytes: Uint8Array, level: PdfALevel): PdfAValid
|
|
|
8306
8306
|
*/
|
|
8307
8307
|
declare function enforcePdfA(pdfBytes: Uint8Array, level: PdfALevel): Promise<Uint8Array>;
|
|
8308
8308
|
//#endregion
|
|
8309
|
-
//#region src/
|
|
8309
|
+
//#region src/wasm/jpeg/bridge.d.ts
|
|
8310
8310
|
/**
|
|
8311
|
-
* @module
|
|
8311
|
+
* @module wasm/jpeg/bridge
|
|
8312
8312
|
*
|
|
8313
|
-
*
|
|
8313
|
+
* TypeScript bridge for the JPEG WASM encoder/decoder module.
|
|
8314
8314
|
*
|
|
8315
|
-
*
|
|
8316
|
-
*
|
|
8317
|
-
* on raw pixel data (not on encoded PNG/JPEG streams).
|
|
8315
|
+
* Provides JPEG encoding (raw pixels → JPEG bytes) and decoding (JPEG bytes →
|
|
8316
|
+
* raw pixels) via a Rust WASM module compiled with wasm-bindgen.
|
|
8318
8317
|
*
|
|
8319
|
-
*
|
|
8320
|
-
*
|
|
8318
|
+
* If the WASM module is not available, all functions fail gracefully and
|
|
8319
|
+
* callers should fall back to JS alternatives.
|
|
8321
8320
|
*
|
|
8322
8321
|
* No Buffer — uses Uint8Array exclusively.
|
|
8323
|
-
* No fs — no file system access.
|
|
8324
|
-
* No require() — ESM import only.
|
|
8325
8322
|
*/
|
|
8323
|
+
/** Pre-built wasm-bindgen module interface (when passed directly). */
|
|
8324
|
+
interface JpegWasmModule {
|
|
8325
|
+
encode_jpeg(pixels: Uint8Array, width: number, height: number, channels: number, quality: number, progressive: boolean, chroma_subsampling: number): Uint8Array;
|
|
8326
|
+
decode_jpeg(data: Uint8Array): Uint8Array;
|
|
8327
|
+
}
|
|
8328
|
+
/**
|
|
8329
|
+
* Chroma subsampling modes for JPEG encoding.
|
|
8330
|
+
*
|
|
8331
|
+
* - `'4:4:4'`: No subsampling — best quality, largest file.
|
|
8332
|
+
* - `'4:2:2'`: Horizontal subsampling — good balance.
|
|
8333
|
+
* - `'4:2:0'`: Both directions — smallest file, default for most encoders.
|
|
8334
|
+
*/
|
|
8335
|
+
type ChromaSubsampling = '4:4:4' | '4:2:2' | '4:2:0';
|
|
8336
|
+
/** Result of decoding a JPEG image. */
|
|
8337
|
+
interface JpegDecodeResult {
|
|
8338
|
+
/** Raw pixel data (row-major, channel-interleaved). */
|
|
8339
|
+
readonly pixels: Uint8Array;
|
|
8340
|
+
/** Image width in pixels. */
|
|
8341
|
+
readonly width: number;
|
|
8342
|
+
/** Image height in pixels. */
|
|
8343
|
+
readonly height: number;
|
|
8344
|
+
/** Number of channels (1=grayscale, 3=RGB). */
|
|
8345
|
+
readonly channels: number;
|
|
8346
|
+
}
|
|
8347
|
+
/**
|
|
8348
|
+
* Initialize the JPEG WASM module.
|
|
8349
|
+
*
|
|
8350
|
+
* @param wasmSource - The WASM binary as `Uint8Array`, URL, `Response`,
|
|
8351
|
+
* or a pre-built wasm-bindgen module. When omitted,
|
|
8352
|
+
* the function uses the universal WASM loader.
|
|
8353
|
+
*/
|
|
8354
|
+
declare function initJpegWasm(wasmSource?: JpegWasmModule | Uint8Array | URL | string | Response): Promise<void>;
|
|
8355
|
+
/**
|
|
8356
|
+
* Check whether the JPEG WASM module has been initialized.
|
|
8357
|
+
*
|
|
8358
|
+
* @returns `true` if {@link initJpegWasm} completed successfully.
|
|
8359
|
+
*/
|
|
8360
|
+
declare function isJpegWasmReady(): boolean;
|
|
8361
|
+
/**
|
|
8362
|
+
* Encode raw pixel data to JPEG using the WASM encoder.
|
|
8363
|
+
*
|
|
8364
|
+
* @param pixels - Raw pixel data (row-major, channel-interleaved).
|
|
8365
|
+
* @param width - Image width in pixels.
|
|
8366
|
+
* @param height - Image height in pixels.
|
|
8367
|
+
* @param channels - Number of channels: 1 (grayscale), 3 (RGB), or 4 (RGBA).
|
|
8368
|
+
* @param quality - JPEG quality 1–100.
|
|
8369
|
+
* @param progressive - Encode as progressive JPEG (default: false).
|
|
8370
|
+
* @param chroma - Chroma subsampling mode (default: '4:2:0').
|
|
8371
|
+
* @returns JPEG-encoded bytes, or `undefined` if WASM is not available.
|
|
8372
|
+
*/
|
|
8373
|
+
declare function encodeJpegWasm(pixels: Uint8Array, width: number, height: number, channels: 1 | 3 | 4, quality: number, progressive?: boolean, chroma?: ChromaSubsampling): Uint8Array | undefined;
|
|
8374
|
+
/**
|
|
8375
|
+
* Decode JPEG bytes to raw pixel data using the WASM decoder.
|
|
8376
|
+
*
|
|
8377
|
+
* The WASM module returns a flat byte array with layout:
|
|
8378
|
+
* `[width_u32_le, height_u32_le, channels_u8, ...pixels]`.
|
|
8379
|
+
*
|
|
8380
|
+
* @param jpegBytes - JPEG-encoded image data.
|
|
8381
|
+
* @returns Decoded pixel data with metadata, or `undefined` if WASM is not
|
|
8382
|
+
* available or decoding failed.
|
|
8383
|
+
*/
|
|
8384
|
+
declare function decodeJpegWasm(jpegBytes: Uint8Array): JpegDecodeResult | undefined;
|
|
8385
|
+
//#endregion
|
|
8386
|
+
//#region src/assets/image/imageOptimize.d.ts
|
|
8326
8387
|
/**
|
|
8327
8388
|
* Options for image downscaling.
|
|
8328
8389
|
*/
|
|
@@ -8386,6 +8447,30 @@ interface RecompressOptions {
|
|
|
8386
8447
|
* Default: `6`.
|
|
8387
8448
|
*/
|
|
8388
8449
|
readonly compressionLevel?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
8450
|
+
/**
|
|
8451
|
+
* Encode as progressive JPEG. Only used when `format` is `'jpeg'`.
|
|
8452
|
+
*
|
|
8453
|
+
* Progressive JPEGs render in multiple passes (low-res → full-res)
|
|
8454
|
+
* which improves perceived loading speed on slow connections.
|
|
8455
|
+
* They are also often slightly smaller than baseline JPEGs.
|
|
8456
|
+
*
|
|
8457
|
+
* Requires the JPEG WASM module to be initialized.
|
|
8458
|
+
*
|
|
8459
|
+
* Default: `false`.
|
|
8460
|
+
*/
|
|
8461
|
+
readonly progressive?: boolean;
|
|
8462
|
+
/**
|
|
8463
|
+
* Chroma subsampling mode. Only used when `format` is `'jpeg'`.
|
|
8464
|
+
*
|
|
8465
|
+
* - `'4:4:4'`: No subsampling — best color fidelity, largest file.
|
|
8466
|
+
* - `'4:2:2'`: Horizontal subsampling — good balance.
|
|
8467
|
+
* - `'4:2:0'`: Both horizontal and vertical — smallest file.
|
|
8468
|
+
*
|
|
8469
|
+
* Requires the JPEG WASM module to be initialized.
|
|
8470
|
+
*
|
|
8471
|
+
* Default: `'4:2:0'`.
|
|
8472
|
+
*/
|
|
8473
|
+
readonly chromaSubsampling?: ChromaSubsampling;
|
|
8389
8474
|
}
|
|
8390
8475
|
/**
|
|
8391
8476
|
* Combined options for the full optimization pipeline.
|
|
@@ -8414,11 +8499,22 @@ interface RawImageData {
|
|
|
8414
8499
|
* - 1: Grayscale
|
|
8415
8500
|
* - 2: Grayscale + Alpha
|
|
8416
8501
|
* - 3: RGB
|
|
8417
|
-
* - 4: RGBA
|
|
8502
|
+
* - 4: RGBA or CMYK (see `colorSpace`)
|
|
8418
8503
|
*/
|
|
8419
8504
|
readonly channels: 1 | 2 | 3 | 4;
|
|
8420
8505
|
/** Bits per channel (typically 8). */
|
|
8421
8506
|
readonly bitsPerChannel: number;
|
|
8507
|
+
/**
|
|
8508
|
+
* Color space of the pixel data.
|
|
8509
|
+
*
|
|
8510
|
+
* - `'rgb'` — Channels are R, G, B (and optionally A).
|
|
8511
|
+
* - `'cmyk'` — Channels are C, M, Y, K (only when `channels` is 4).
|
|
8512
|
+
* CMYK pixels are converted to RGB before JPEG encoding.
|
|
8513
|
+
* - `'gray'` — Grayscale (only when `channels` is 1 or 2).
|
|
8514
|
+
*
|
|
8515
|
+
* Default: inferred from channel count (`1|2 → 'gray'`, `3|4 → 'rgb'`).
|
|
8516
|
+
*/
|
|
8517
|
+
readonly colorSpace?: 'rgb' | 'cmyk' | 'gray';
|
|
8422
8518
|
}
|
|
8423
8519
|
/**
|
|
8424
8520
|
* The result of an optimization operation.
|
|
@@ -8481,6 +8577,378 @@ declare function recompressImage(image: RawImageData, options?: RecompressOption
|
|
|
8481
8577
|
* @returns The optimized result.
|
|
8482
8578
|
*/
|
|
8483
8579
|
declare function optimizeImage(image: RawImageData, options?: ImageOptimizeOptions): Promise<OptimizeResult>;
|
|
8580
|
+
/**
|
|
8581
|
+
* Estimate the JPEG quality level (1–100) from the quantization tables
|
|
8582
|
+
* embedded in a JPEG file.
|
|
8583
|
+
*
|
|
8584
|
+
* Parses the DQT (Define Quantization Table, marker 0xFFDB) segments
|
|
8585
|
+
* from the raw JPEG bytes and compares the table values against the
|
|
8586
|
+
* standard JPEG luminance quantization table to estimate the quality
|
|
8587
|
+
* factor that was used during encoding.
|
|
8588
|
+
*
|
|
8589
|
+
* If no DQT marker is found, returns `undefined`.
|
|
8590
|
+
*
|
|
8591
|
+
* @param jpegBytes - Raw JPEG file bytes.
|
|
8592
|
+
* @returns Estimated quality 1–100, or `undefined` if no DQT is found.
|
|
8593
|
+
*
|
|
8594
|
+
* @example
|
|
8595
|
+
* ```ts
|
|
8596
|
+
* import { estimateJpegQuality } from 'modern-pdf-lib';
|
|
8597
|
+
*
|
|
8598
|
+
* const quality = estimateJpegQuality(jpegBytes);
|
|
8599
|
+
* if (quality !== undefined) {
|
|
8600
|
+
* console.log(`Estimated JPEG quality: ${quality}`);
|
|
8601
|
+
* }
|
|
8602
|
+
* ```
|
|
8603
|
+
*/
|
|
8604
|
+
declare function estimateJpegQuality(jpegBytes: Uint8Array): number | undefined;
|
|
8605
|
+
//#endregion
|
|
8606
|
+
//#region src/assets/image/imageExtract.d.ts
|
|
8607
|
+
/**
|
|
8608
|
+
* Information about a single image XObject in a PDF document.
|
|
8609
|
+
*/
|
|
8610
|
+
interface ImageInfo {
|
|
8611
|
+
/** The PdfStream object for this image (can be mutated for in-place optimization). */
|
|
8612
|
+
readonly stream: PdfStream;
|
|
8613
|
+
/** The indirect reference to this stream in the registry. */
|
|
8614
|
+
readonly ref: PdfRef;
|
|
8615
|
+
/** Resource name on the page (e.g. '/Im1'). */
|
|
8616
|
+
readonly name: string;
|
|
8617
|
+
/** Zero-based page index where this image appears. */
|
|
8618
|
+
readonly pageIndex: number;
|
|
8619
|
+
/** Image width in pixels. */
|
|
8620
|
+
readonly width: number;
|
|
8621
|
+
/** Image height in pixels. */
|
|
8622
|
+
readonly height: number;
|
|
8623
|
+
/** Bits per component (typically 8). */
|
|
8624
|
+
readonly bitsPerComponent: number;
|
|
8625
|
+
/** PDF color space name (e.g. 'DeviceRGB', 'DeviceGray', 'DeviceCMYK'). */
|
|
8626
|
+
readonly colorSpace: string;
|
|
8627
|
+
/** Number of color channels (1, 3, or 4). */
|
|
8628
|
+
readonly channels: number;
|
|
8629
|
+
/** PDF filter name(s) applied to this stream. */
|
|
8630
|
+
readonly filters: readonly string[];
|
|
8631
|
+
/** Size of the compressed stream data in bytes. */
|
|
8632
|
+
readonly compressedSize: number;
|
|
8633
|
+
}
|
|
8634
|
+
/**
|
|
8635
|
+
* Extract all image XObjects from a PDF document.
|
|
8636
|
+
*
|
|
8637
|
+
* Walks every page's `/Resources /XObject` dictionary and collects
|
|
8638
|
+
* metadata for each image XObject found.
|
|
8639
|
+
*
|
|
8640
|
+
* @param doc - A parsed `PdfDocument`.
|
|
8641
|
+
* @returns An array of `ImageInfo` objects, one per image XObject.
|
|
8642
|
+
*
|
|
8643
|
+
* @example
|
|
8644
|
+
* ```ts
|
|
8645
|
+
* import { loadPdf, extractImages } from 'modern-pdf-lib';
|
|
8646
|
+
*
|
|
8647
|
+
* const doc = await loadPdf(pdfBytes);
|
|
8648
|
+
* const images = extractImages(doc);
|
|
8649
|
+
*
|
|
8650
|
+
* for (const img of images) {
|
|
8651
|
+
* console.log(`${img.name}: ${img.width}x${img.height} ${img.colorSpace} (${img.compressedSize} bytes)`);
|
|
8652
|
+
* }
|
|
8653
|
+
* ```
|
|
8654
|
+
*/
|
|
8655
|
+
declare function extractImages(doc: PdfDocument): ImageInfo[];
|
|
8656
|
+
/**
|
|
8657
|
+
* Decode image stream data into raw pixels.
|
|
8658
|
+
*
|
|
8659
|
+
* For DCTDecode (JPEG) streams, returns the raw JPEG bytes (not decoded
|
|
8660
|
+
* to pixels) since JPEG decoding requires the WASM module.
|
|
8661
|
+
*
|
|
8662
|
+
* For FlateDecode and other filters, fully decodes the stream.
|
|
8663
|
+
*
|
|
8664
|
+
* @param imageInfo - An `ImageInfo` from `extractImages()`.
|
|
8665
|
+
* @returns The decoded stream data.
|
|
8666
|
+
*/
|
|
8667
|
+
declare function decodeImageStream(imageInfo: ImageInfo): Uint8Array;
|
|
8668
|
+
//#endregion
|
|
8669
|
+
//#region src/assets/image/batchOptimize.d.ts
|
|
8670
|
+
/**
|
|
8671
|
+
* Options for batch image optimization.
|
|
8672
|
+
*/
|
|
8673
|
+
interface BatchOptimizeOptions {
|
|
8674
|
+
/**
|
|
8675
|
+
* JPEG quality (1–100) for recompressed images.
|
|
8676
|
+
*
|
|
8677
|
+
* Default: `80`.
|
|
8678
|
+
*/
|
|
8679
|
+
readonly quality?: number;
|
|
8680
|
+
/**
|
|
8681
|
+
* Maximum DPI for images. Images exceeding this DPI at their
|
|
8682
|
+
* display size will be downscaled before recompression.
|
|
8683
|
+
*
|
|
8684
|
+
* Default: `150`.
|
|
8685
|
+
*/
|
|
8686
|
+
readonly maxDpi?: number;
|
|
8687
|
+
/**
|
|
8688
|
+
* Encode as progressive JPEG.
|
|
8689
|
+
*
|
|
8690
|
+
* Default: `false`.
|
|
8691
|
+
*/
|
|
8692
|
+
readonly progressive?: boolean;
|
|
8693
|
+
/**
|
|
8694
|
+
* Chroma subsampling mode for JPEG encoding.
|
|
8695
|
+
*
|
|
8696
|
+
* Default: `'4:2:0'`.
|
|
8697
|
+
*/
|
|
8698
|
+
readonly chromaSubsampling?: ChromaSubsampling;
|
|
8699
|
+
/**
|
|
8700
|
+
* Skip images smaller than this threshold (in bytes).
|
|
8701
|
+
*
|
|
8702
|
+
* Default: `false` (process all images).
|
|
8703
|
+
*/
|
|
8704
|
+
readonly skipSmallImages?: boolean;
|
|
8705
|
+
/**
|
|
8706
|
+
* Minimum savings percentage required to replace an image.
|
|
8707
|
+
* If the recompressed image is not at least this much smaller,
|
|
8708
|
+
* the original is kept.
|
|
8709
|
+
*
|
|
8710
|
+
* Default: `10`.
|
|
8711
|
+
*/
|
|
8712
|
+
readonly minSavingsPercent?: number;
|
|
8713
|
+
/**
|
|
8714
|
+
* Auto-detect and convert pseudo-grayscale RGB images to true
|
|
8715
|
+
* grayscale before encoding.
|
|
8716
|
+
*
|
|
8717
|
+
* Default: `false`.
|
|
8718
|
+
*/
|
|
8719
|
+
readonly autoGrayscale?: boolean;
|
|
8720
|
+
}
|
|
8721
|
+
/**
|
|
8722
|
+
* Per-image optimization report entry.
|
|
8723
|
+
*/
|
|
8724
|
+
interface ImageOptimizeEntry {
|
|
8725
|
+
/** Resource name (e.g. '/Im1'). */
|
|
8726
|
+
readonly name: string;
|
|
8727
|
+
/** Page index where this image appears. */
|
|
8728
|
+
readonly pageIndex: number;
|
|
8729
|
+
/** Original compressed size in bytes. */
|
|
8730
|
+
readonly originalSize: number;
|
|
8731
|
+
/** New compressed size in bytes (same as original if skipped). */
|
|
8732
|
+
readonly newSize: number;
|
|
8733
|
+
/** Whether this image was skipped. */
|
|
8734
|
+
readonly skipped: boolean;
|
|
8735
|
+
/** Reason for skipping, if applicable. */
|
|
8736
|
+
readonly reason?: string;
|
|
8737
|
+
}
|
|
8738
|
+
/**
|
|
8739
|
+
* Summary report from batch image optimization.
|
|
8740
|
+
*/
|
|
8741
|
+
interface OptimizationReport {
|
|
8742
|
+
/** Total number of image XObjects found. */
|
|
8743
|
+
readonly totalImages: number;
|
|
8744
|
+
/** Number of images that were recompressed. */
|
|
8745
|
+
readonly optimizedImages: number;
|
|
8746
|
+
/** Total original compressed size (all images). */
|
|
8747
|
+
readonly originalTotalBytes: number;
|
|
8748
|
+
/** Total new compressed size (all images). */
|
|
8749
|
+
readonly optimizedTotalBytes: number;
|
|
8750
|
+
/** Overall savings percentage. */
|
|
8751
|
+
readonly savings: number;
|
|
8752
|
+
/** Per-image details. */
|
|
8753
|
+
readonly perImage: readonly ImageOptimizeEntry[];
|
|
8754
|
+
}
|
|
8755
|
+
/**
|
|
8756
|
+
* Optimize all images in a PDF document by recompressing them as JPEG.
|
|
8757
|
+
*
|
|
8758
|
+
* Walks every image XObject in the document, decodes its pixel data,
|
|
8759
|
+
* recompresses it as JPEG using the WASM encoder (if available), and
|
|
8760
|
+
* replaces the stream data in-place when the result is smaller.
|
|
8761
|
+
*
|
|
8762
|
+
* **Requires the JPEG WASM module to be initialized** via
|
|
8763
|
+
* `initJpegWasm()` or `initWasm({ jpeg: true })`. Without it,
|
|
8764
|
+
* no images will be optimized (all will be skipped).
|
|
8765
|
+
*
|
|
8766
|
+
* @param doc - A parsed `PdfDocument` (from `loadPdf()`).
|
|
8767
|
+
* @param options - Optimization settings.
|
|
8768
|
+
* @returns A report summarizing the optimization results.
|
|
8769
|
+
*
|
|
8770
|
+
* @example
|
|
8771
|
+
* ```ts
|
|
8772
|
+
* import { loadPdf, initWasm, optimizeAllImages } from 'modern-pdf-lib';
|
|
8773
|
+
*
|
|
8774
|
+
* await initWasm({ jpeg: true });
|
|
8775
|
+
*
|
|
8776
|
+
* const doc = await loadPdf(pdfBytes);
|
|
8777
|
+
* const report = await optimizeAllImages(doc);
|
|
8778
|
+
*
|
|
8779
|
+
* console.log(`Optimized ${report.optimizedImages} of ${report.totalImages} images`);
|
|
8780
|
+
* console.log(`Savings: ${report.savings.toFixed(1)}%`);
|
|
8781
|
+
*
|
|
8782
|
+
* const optimizedBytes = await doc.save();
|
|
8783
|
+
* ```
|
|
8784
|
+
*/
|
|
8785
|
+
declare function optimizeAllImages(doc: PdfDocument, options?: BatchOptimizeOptions): Promise<OptimizationReport>;
|
|
8786
|
+
//#endregion
|
|
8787
|
+
//#region src/assets/image/deduplicateImages.d.ts
|
|
8788
|
+
/**
|
|
8789
|
+
* Report from image deduplication.
|
|
8790
|
+
*/
|
|
8791
|
+
interface DeduplicationReport {
|
|
8792
|
+
/** Total number of image XObjects found. */
|
|
8793
|
+
readonly totalImages: number;
|
|
8794
|
+
/** Number of unique images (after deduplication). */
|
|
8795
|
+
readonly uniqueImages: number;
|
|
8796
|
+
/** Number of duplicate references replaced. */
|
|
8797
|
+
readonly duplicatesRemoved: number;
|
|
8798
|
+
/** Estimated bytes saved by deduplication. */
|
|
8799
|
+
readonly bytesSaved: number;
|
|
8800
|
+
}
|
|
8801
|
+
/**
|
|
8802
|
+
* Deduplicate identical images in a PDF document.
|
|
8803
|
+
*
|
|
8804
|
+
* Scans all image XObjects, hashes their compressed stream data (plus
|
|
8805
|
+
* dimensions and filter), and replaces duplicate references in page
|
|
8806
|
+
* resource dictionaries with the canonical (first-seen) copy.
|
|
8807
|
+
*
|
|
8808
|
+
* This operation modifies the document in-place. Duplicate streams
|
|
8809
|
+
* are not removed from the object registry (they become unreferenced
|
|
8810
|
+
* and will be omitted on save if the writer supports garbage collection).
|
|
8811
|
+
*
|
|
8812
|
+
* @param doc - A parsed `PdfDocument` (from `loadPdf()`).
|
|
8813
|
+
* @returns A report summarizing deduplication results.
|
|
8814
|
+
*
|
|
8815
|
+
* @example
|
|
8816
|
+
* ```ts
|
|
8817
|
+
* import { loadPdf, deduplicateImages } from 'modern-pdf-lib';
|
|
8818
|
+
*
|
|
8819
|
+
* const doc = await loadPdf(pdfBytes);
|
|
8820
|
+
* const report = await deduplicateImages(doc);
|
|
8821
|
+
*
|
|
8822
|
+
* console.log(`Removed ${report.duplicatesRemoved} duplicate images`);
|
|
8823
|
+
* console.log(`Saved ~${(report.bytesSaved / 1024).toFixed(0)} KB`);
|
|
8824
|
+
*
|
|
8825
|
+
* const optimizedBytes = await doc.save();
|
|
8826
|
+
* ```
|
|
8827
|
+
*/
|
|
8828
|
+
declare function deduplicateImages(doc: PdfDocument): DeduplicationReport;
|
|
8829
|
+
//#endregion
|
|
8830
|
+
//#region src/assets/image/grayscaleDetect.d.ts
|
|
8831
|
+
/**
|
|
8832
|
+
* @module assets/image/grayscaleDetect
|
|
8833
|
+
*
|
|
8834
|
+
* Grayscale detection and conversion for image optimization.
|
|
8835
|
+
*
|
|
8836
|
+
* Detects RGB images where all pixels are effectively grayscale
|
|
8837
|
+
* (R ≈ G ≈ B) and converts them to single-channel grayscale,
|
|
8838
|
+
* reducing data size by ~66%.
|
|
8839
|
+
*
|
|
8840
|
+
* No Buffer — uses Uint8Array exclusively.
|
|
8841
|
+
*/
|
|
8842
|
+
/**
|
|
8843
|
+
* Check whether an RGB/RGBA image is effectively grayscale.
|
|
8844
|
+
*
|
|
8845
|
+
* Scans all pixels and checks if R, G, and B channels are within
|
|
8846
|
+
* `tolerance` of each other. If ≥99% of pixels pass, the image
|
|
8847
|
+
* is considered grayscale.
|
|
8848
|
+
*
|
|
8849
|
+
* @param pixels - Raw pixel data (row-major, channel-interleaved).
|
|
8850
|
+
* @param width - Image width in pixels.
|
|
8851
|
+
* @param height - Image height in pixels.
|
|
8852
|
+
* @param channels - Number of channels: 3 (RGB) or 4 (RGBA).
|
|
8853
|
+
* @param tolerance - Maximum allowed difference between R, G, and B
|
|
8854
|
+
* values for a pixel to be considered gray.
|
|
8855
|
+
* Default: `2`.
|
|
8856
|
+
* @returns `true` if the image is effectively grayscale.
|
|
8857
|
+
*
|
|
8858
|
+
* @example
|
|
8859
|
+
* ```ts
|
|
8860
|
+
* import { isGrayscaleImage, convertToGrayscale } from 'modern-pdf-lib';
|
|
8861
|
+
*
|
|
8862
|
+
* if (isGrayscaleImage(pixels, width, height, 3)) {
|
|
8863
|
+
* const grayPixels = convertToGrayscale(pixels, width, height, 3);
|
|
8864
|
+
* // grayPixels has 1 byte per pixel instead of 3
|
|
8865
|
+
* }
|
|
8866
|
+
* ```
|
|
8867
|
+
*/
|
|
8868
|
+
declare function isGrayscaleImage(pixels: Uint8Array, width: number, height: number, channels: 3 | 4, tolerance?: number): boolean;
|
|
8869
|
+
/**
|
|
8870
|
+
* Convert an RGB/RGBA image to single-channel grayscale.
|
|
8871
|
+
*
|
|
8872
|
+
* Uses the ITU-R BT.601 luma formula:
|
|
8873
|
+
* ```
|
|
8874
|
+
* gray = 0.299 × R + 0.587 × G + 0.114 × B
|
|
8875
|
+
* ```
|
|
8876
|
+
*
|
|
8877
|
+
* The alpha channel (if present) is discarded.
|
|
8878
|
+
*
|
|
8879
|
+
* @param pixels - Raw pixel data (row-major, channel-interleaved).
|
|
8880
|
+
* @param width - Image width in pixels.
|
|
8881
|
+
* @param height - Image height in pixels.
|
|
8882
|
+
* @param channels - Number of channels: 3 (RGB) or 4 (RGBA).
|
|
8883
|
+
* @returns Grayscale pixel data (1 byte per pixel).
|
|
8884
|
+
*/
|
|
8885
|
+
declare function convertToGrayscale(pixels: Uint8Array, width: number, height: number, channels: 3 | 4): Uint8Array;
|
|
8886
|
+
//#endregion
|
|
8887
|
+
//#region src/assets/image/dpiAnalyze.d.ts
|
|
8888
|
+
/**
|
|
8889
|
+
* @module assets/image/dpiAnalyze
|
|
8890
|
+
*
|
|
8891
|
+
* DPI analysis for PDF image XObjects.
|
|
8892
|
+
*
|
|
8893
|
+
* Computes the effective DPI of an image based on its pixel dimensions
|
|
8894
|
+
* and its display size in the PDF (determined by the content stream's
|
|
8895
|
+
* current transformation matrix).
|
|
8896
|
+
*
|
|
8897
|
+
* No Buffer — uses Uint8Array exclusively.
|
|
8898
|
+
*/
|
|
8899
|
+
/**
|
|
8900
|
+
* DPI information for an image.
|
|
8901
|
+
*/
|
|
8902
|
+
interface ImageDpi {
|
|
8903
|
+
/** Horizontal DPI. */
|
|
8904
|
+
readonly xDpi: number;
|
|
8905
|
+
/** Vertical DPI. */
|
|
8906
|
+
readonly yDpi: number;
|
|
8907
|
+
/** Effective DPI (minimum of xDpi and yDpi). */
|
|
8908
|
+
readonly effectiveDpi: number;
|
|
8909
|
+
}
|
|
8910
|
+
/**
|
|
8911
|
+
* Compute the effective DPI of an image given its pixel dimensions
|
|
8912
|
+
* and display dimensions in points.
|
|
8913
|
+
*
|
|
8914
|
+
* PDF uses 72 points per inch, so:
|
|
8915
|
+
* ```
|
|
8916
|
+
* DPI = imagePixels / (displayPoints / 72)
|
|
8917
|
+
* ```
|
|
8918
|
+
*
|
|
8919
|
+
* @param imageWidth - Image width in pixels.
|
|
8920
|
+
* @param imageHeight - Image height in pixels.
|
|
8921
|
+
* @param displayWidth - Display width in PDF points (1/72 inch).
|
|
8922
|
+
* @param displayHeight - Display height in PDF points (1/72 inch).
|
|
8923
|
+
* @returns DPI information.
|
|
8924
|
+
*
|
|
8925
|
+
* @example
|
|
8926
|
+
* ```ts
|
|
8927
|
+
* import { computeImageDpi } from 'modern-pdf-lib';
|
|
8928
|
+
*
|
|
8929
|
+
* // A 3000×2000 image displayed at 4.17×2.78 inches (300×200 points)
|
|
8930
|
+
* const dpi = computeImageDpi(3000, 2000, 300, 200);
|
|
8931
|
+
* console.log(dpi.effectiveDpi); // 720
|
|
8932
|
+
* ```
|
|
8933
|
+
*/
|
|
8934
|
+
declare function computeImageDpi(imageWidth: number, imageHeight: number, displayWidth: number, displayHeight: number): ImageDpi;
|
|
8935
|
+
/**
|
|
8936
|
+
* Compute the target pixel dimensions for downscaling an image
|
|
8937
|
+
* to a maximum DPI at a given display size.
|
|
8938
|
+
*
|
|
8939
|
+
* @param imageWidth - Current image width in pixels.
|
|
8940
|
+
* @param imageHeight - Current image height in pixels.
|
|
8941
|
+
* @param displayWidth - Display width in PDF points.
|
|
8942
|
+
* @param displayHeight - Display height in PDF points.
|
|
8943
|
+
* @param maxDpi - Maximum allowed DPI.
|
|
8944
|
+
* @returns Target dimensions, or the original dimensions if no
|
|
8945
|
+
* downscaling is needed.
|
|
8946
|
+
*/
|
|
8947
|
+
declare function computeTargetDimensions(imageWidth: number, imageHeight: number, displayWidth: number, displayHeight: number, maxDpi: number): {
|
|
8948
|
+
width: number;
|
|
8949
|
+
height: number;
|
|
8950
|
+
downscaled: boolean;
|
|
8951
|
+
};
|
|
8484
8952
|
//#endregion
|
|
8485
8953
|
//#region src/utils/base64.d.ts
|
|
8486
8954
|
/**
|
|
@@ -8652,6 +9120,12 @@ interface InitWasmOptions {
|
|
|
8652
9120
|
* Pre-loaded WASM bytes for the font subsetting module.
|
|
8653
9121
|
*/
|
|
8654
9122
|
fontWasm?: Uint8Array | undefined;
|
|
9123
|
+
/** Initialize the JPEG encoding/decoding WASM module. Default: `false`. */
|
|
9124
|
+
jpeg?: boolean | undefined;
|
|
9125
|
+
/**
|
|
9126
|
+
* Pre-loaded WASM bytes for the JPEG encoding/decoding module.
|
|
9127
|
+
*/
|
|
9128
|
+
jpegWasm?: Uint8Array | undefined;
|
|
8655
9129
|
}
|
|
8656
9130
|
/**
|
|
8657
9131
|
* Initialize the optional WASM acceleration modules.
|
|
@@ -8673,5 +9147,5 @@ interface InitWasmOptions {
|
|
|
8673
9147
|
*/
|
|
8674
9148
|
declare function initWasm(options?: string | URL | InitWasmOptions): Promise<void>;
|
|
8675
9149
|
//#endregion
|
|
8676
|
-
export { type AccessibilityIssue, type Angle, AnnotationFlags, type AnnotationOptions, type AnnotationType, type AppearanceProviderFor, BlendMode, type ButtonAppearanceOptions, type ByteRangeResult, type ByteWriter, type CIDFontData, type CIDSystemInfoData, type CaretSymbol, type CatalogOptions, ChangeTracker, type CheckboxAppearanceOptions, type CmykColor, type Color, type ColorStop, CombedTextLayoutError, type ComputeFontSizeOptions, type ContentStreamOperator, type CropBox, type Degrees, type DocumentMetadata, type DocumentStructure, type DownscaleOptions, type DrawCircleOptions, type DrawEllipseOptions, type DrawImageOptions, type DrawLineOptions, type DrawPageOptions, type DrawRectangleOptions, type DrawSquareOptions, type DrawSvgPathOptions, type DrawTextOptions, type DropdownAppearanceOptions, type EmbedFontOptions, type EmbedPageOptions, type EmbeddedFile, EmbeddedFont, type EmbeddedPdfPage, type EncryptAlgorithm, type EncryptDictValues, type EncryptOptions, EncryptedPdfError, ExceededMaxLengthError, FieldAlreadyExistsError, FieldExistsAsNonTerminalError, FieldFlags, type FieldType, type FileAttachmentIcon, type FontDescriptorData, type FontEmbeddingResult, type FontMetrics, FontNotEmbeddedError, type FontRef, ForeignPageError, type FreeTextAlignment, type GradientFill, type GrayscaleColor, ImageAlignment, type ImageOptimizeOptions, type ImageRef, type IncrementalSaveResult, InitWasmOptions, InvalidFieldNamePartError, type LayoutCombedOptions, type LayoutMultilineOptions, type LayoutMultilineResult, type LayoutSinglelineOptions, type LayoutSinglelineResult, LineCapStyle, type LineEndingStyle, LineJoinStyle, type LinearGradientOptions, type LinearizationOptions, type LinkHighlightMode, type ListboxAppearanceOptions, type LoadPdfOptions, type MarkedContentScope, MissingOnValueCheckError, NoSuchFieldError, type NormalizedStop, type Operand, type OptimizeResult, type OutlineDestination, type OutlineItemOptions, PDFOperator, type PageEntry, type PageRange, type PageSize, PageSizes, ParseSpeeds, type PatternFill, type PdfAIssue, type PdfALevel, type PdfAValidationResult, PdfAnnotation, PdfArray, PdfBool, PdfButtonField, PdfCaretAnnotation, PdfCheckboxField, PdfCircleAnnotation, PdfDict, PdfDocument, PdfDropdownField, PdfEncryptionHandler, PdfField, PdfFileAttachmentAnnotation, PdfForm, PdfFreeTextAnnotation, PdfHighlightAnnotation, PdfInkAnnotation, PdfLayer, PdfLayerManager, PdfLineAnnotation, PdfLinkAnnotation, PdfListboxField, PdfName, PdfNull, PdfNumber, type PdfObject, PdfObjectRegistry, PdfOutlineItem, PdfOutlineTree, PdfPage, PdfParseError, type PdfPermissionFlags, PdfPolyLineAnnotation, PdfPolygonAnnotation, PdfPopupAnnotation, PdfRadioGroup, PdfRedactAnnotation, PdfRef, type PdfSaveOptions, PdfSignatureField, type PdfSignatureInfo, PdfSquareAnnotation, PdfSquigglyAnnotation, PdfStampAnnotation, PdfStream, PdfStreamWriter, PdfStrikeOutAnnotation, PdfString, PdfStructureElement, PdfStructureTree, PdfTextAnnotation, PdfTextField, PdfUnderlineAnnotation, PdfViewerPreferences, PdfWriter, type RadialGradientFill, type RadialGradientOptions, type Radians, type RadioAppearanceOptions, type RawImageData, type RecompressOptions, type RedactionMark, type RedactionOptions, type RefResolver, type RegistryEntry, RemovePageFromEmptyDocumentError, type RgbColor, RichTextFieldReadError, type SetTitleOptions, type SignOptions, type SignatureAppearanceOptions, type SignatureOptions, type SignatureVerificationResult, type SignerInfo, type SoftMaskBuilder, type SoftMaskRef, type StandardFontName, StandardFonts, type StandardStampName, type StructureElementOptions, type StructureType, type SubsetCmap, type SubsetResult, type SvgDrawCommand, type SvgElement, type SvgRenderOptions, TextAlignment, type TextAnnotationIcon, type TextAppearanceOptions, type TextExtractionOptions, type TextItem, TextRenderingMode, type TilingPatternOptions, type TimestampResult, type TransparencyGroupOptions, type Type0FontData, UnexpectedFieldTypeError, type ViewerPreferences, type VisibleSignatureOptions, type WatermarkOptions, type WidgetAnnotationHost, type WidthEntry, addWatermark, addWatermarkToPage, aesDecryptCBC, aesEncryptCBC, annotationFromDict, applyFillColor, applyRedactions, applyStrokeColor, asNumber, asPDFName, asPDFNumber, attachFile, base64Decode, base64Encode, beginArtifact, beginArtifactWithType, beginLayerContent, beginMarkedContent, beginMarkedContentSequence, beginMarkedContentWithProperties, beginText, buildAnnotationDict, buildCatalog, buildDocumentStructure, buildEmbeddedFilesNameTree, buildGradientObjects, buildInfoDict, buildPageTree, buildPatternObjects, buildPkcs7Signature, buildTimestampRequest, buildViewerPreferencesDict, buildXmpMetadata, checkAccessibility, circlePath, clipEvenOdd, clip as clipOp, closeAndStroke, closeFillAndStroke, closeFillEvenOddAndStroke, closePath as closePathOp, cmyk, colorToComponents, componentsToColor, computeFileEncryptionKey, computeFontSize, computeSignatureHash, concatMatrix, concatMatrix as concatTransformationMatrix, copyPages, createAnnotation, createMarkedContentScope, createPdf, createXmpStream, cropPage, curveToFinal, curveToInitial, curveTo as curveToOp, decodePermissions, decodeStream, degrees, degreesToRadians, downscaleImage, drawImageWithMatrix, drawImageXObject, drawXObject as drawObject, drawXObject, drawSvgOnPage, ellipsePath, embedPageAsFormXObject, embedSignature, encodeContextTag, encodeInteger, encodeLength, encodeOID, encodeOctetString, encodePermissions, encodePrintableString, encodeSequence, encodeSet, encodeUTCTime, encodeUtf8String, endArtifact, endLayerContent, endMarkedContent, endPath as endPathOp, endText, enforcePdfA, extractMetrics, extractText, extractTextWithPositions, fillAndStroke as fillAndStrokeOp, fillEvenOdd, fillEvenOddAndStroke, fill as fillOp, findSignatures, formatHexContext, formatPdfDate, generateButtonAppearance, generateCheckboxAppearance, generateCircleAppearance, generateDropdownAppearance, generateFreeTextAppearance, generateHighlightAppearance, generateInkAppearance, generateLineAppearance, generateListboxAppearance, generateRadioAppearance, generateSignatureAppearance, generateSquareAppearance, generateSquigglyAppearance, generateStrikeOutAppearance, generateTextAppearance, generateUnderlineAppearance, getAttachments, getPageSize, getRedactionMarks, getSignatures, grayscale, initWasm, insertPage, isAccessible, isLinearized, isOpenTypeCFF, isTrueType, layoutCombedText, layoutMultilineText, layoutSinglelineText, lineTo as lineToOp, linearGradient, linearizePdf, loadPdf, markForRedaction, md5, mergePdfs, movePage, moveText as moveTextOp, moveTextSetLeading, moveTo as moveToOp, nextLine as nextLineOp, optimizeImage, parseContentStream, parseSvg, parseSvgColor, parseSvgPath, parseSvgTransform, parseTimestampResponse, parseViewerPreferences, parseXmpMetadata, restoreState as popGraphicsState, restoreState, prepareForSigning, saveState as pushGraphicsState, saveState, radialGradient, radians, radiansToDegrees, rc4, recompressImage, rectangle as rectangleOp, removePage, removePages, requestTimestamp, resizePage, reversePages, rgb, rotateAllPages, rotate as rotateOp, rotatePage, rotationMatrix, saveDocumentIncremental, saveIncremental, scale as scaleOp, serializePdf, setCharacterSpacing as setCharacterSpacingOp, setCharacterSpacing as setCharacterSqueeze, setColorSpace, setDashPattern as setDashPatternOp, setFillColor, setFillColorCmyk, setFillColorGray, setFillColorRgb, setFillingColor, setFlatness, setFont as setFontAndSize, setFont as setFontOp, setFontSize as setFontSizeOp, setGraphicsState as setGraphicsStateOp, setLeading as setLeadingOp, setLeading as setLineHeight, setLineCap as setLineCapOp, setLineJoin as setLineJoinOp, setLineWidth as setLineWidthOp, setMiterLimit, setStrokeColor, setStrokeColorCmyk, setStrokeColorGray, setStrokeColorRgb, setStrokeColorSpace, setStrokingColor, setTextMatrix as setTextMatrixOp, setTextRenderingMode as setTextRenderingModeOp, setTextRise as setTextRiseOp, setWordSpacing as setWordSpacingOp, sha256, sha384, sha512, showTextArray, showTextHex, showTextNextLine, showText as showTextOp, showTextWithSpacing, signPdf, skew as skewOp, splitPdf, stroke as strokeOp, summarizeIssues, svgToPdfOperators, tilingPattern, translate as translateOp, validatePdfA, verifyOwnerPassword, verifySignature, verifySignatures, verifyUserPassword, wrapInMarkedContent };
|
|
9150
|
+
export { type AccessibilityIssue, type Angle, AnnotationFlags, type AnnotationOptions, type AnnotationType, type AppearanceProviderFor, type BatchOptimizeOptions, BlendMode, type ButtonAppearanceOptions, type ByteRangeResult, type ByteWriter, type CIDFontData, type CIDSystemInfoData, type CaretSymbol, type CatalogOptions, ChangeTracker, type CheckboxAppearanceOptions, type ChromaSubsampling, type CmykColor, type Color, type ColorStop, CombedTextLayoutError, type ComputeFontSizeOptions, type ContentStreamOperator, type CropBox, type DeduplicationReport, type Degrees, type DocumentMetadata, type DocumentStructure, type DownscaleOptions, type DrawCircleOptions, type DrawEllipseOptions, type DrawImageOptions, type DrawLineOptions, type DrawPageOptions, type DrawRectangleOptions, type DrawSquareOptions, type DrawSvgPathOptions, type DrawTextOptions, type DropdownAppearanceOptions, type EmbedFontOptions, type EmbedPageOptions, type EmbeddedFile, EmbeddedFont, type EmbeddedPdfPage, type EncryptAlgorithm, type EncryptDictValues, type EncryptOptions, EncryptedPdfError, ExceededMaxLengthError, FieldAlreadyExistsError, FieldExistsAsNonTerminalError, FieldFlags, type FieldType, type FileAttachmentIcon, type FontDescriptorData, type FontEmbeddingResult, type FontMetrics, FontNotEmbeddedError, type FontRef, ForeignPageError, type FreeTextAlignment, type GradientFill, type GrayscaleColor, ImageAlignment, type ImageDpi, type ImageInfo, type ImageOptimizeEntry, type ImageOptimizeOptions, type ImageRef, type IncrementalSaveResult, InitWasmOptions, InvalidFieldNamePartError, type JpegDecodeResult, type LayoutCombedOptions, type LayoutMultilineOptions, type LayoutMultilineResult, type LayoutSinglelineOptions, type LayoutSinglelineResult, LineCapStyle, type LineEndingStyle, LineJoinStyle, type LinearGradientOptions, type LinearizationOptions, type LinkHighlightMode, type ListboxAppearanceOptions, type LoadPdfOptions, type MarkedContentScope, MissingOnValueCheckError, NoSuchFieldError, type NormalizedStop, type Operand, type OptimizationReport, type OptimizeResult, type OutlineDestination, type OutlineItemOptions, PDFOperator, type PageEntry, type PageRange, type PageSize, PageSizes, ParseSpeeds, type PatternFill, type PdfAIssue, type PdfALevel, type PdfAValidationResult, PdfAnnotation, PdfArray, PdfBool, PdfButtonField, PdfCaretAnnotation, PdfCheckboxField, PdfCircleAnnotation, PdfDict, PdfDocument, PdfDropdownField, PdfEncryptionHandler, PdfField, PdfFileAttachmentAnnotation, PdfForm, PdfFreeTextAnnotation, PdfHighlightAnnotation, PdfInkAnnotation, PdfLayer, PdfLayerManager, PdfLineAnnotation, PdfLinkAnnotation, PdfListboxField, PdfName, PdfNull, PdfNumber, type PdfObject, PdfObjectRegistry, PdfOutlineItem, PdfOutlineTree, PdfPage, PdfParseError, type PdfPermissionFlags, PdfPolyLineAnnotation, PdfPolygonAnnotation, PdfPopupAnnotation, PdfRadioGroup, PdfRedactAnnotation, PdfRef, type PdfSaveOptions, PdfSignatureField, type PdfSignatureInfo, PdfSquareAnnotation, PdfSquigglyAnnotation, PdfStampAnnotation, PdfStream, PdfStreamWriter, PdfStrikeOutAnnotation, PdfString, PdfStructureElement, PdfStructureTree, PdfTextAnnotation, PdfTextField, PdfUnderlineAnnotation, PdfViewerPreferences, PdfWriter, type RadialGradientFill, type RadialGradientOptions, type Radians, type RadioAppearanceOptions, type RawImageData, type RecompressOptions, type RedactionMark, type RedactionOptions, type RefResolver, type RegistryEntry, RemovePageFromEmptyDocumentError, type RgbColor, RichTextFieldReadError, type SetTitleOptions, type SignOptions, type SignatureAppearanceOptions, type SignatureOptions, type SignatureVerificationResult, type SignerInfo, type SoftMaskBuilder, type SoftMaskRef, type StandardFontName, StandardFonts, type StandardStampName, type StructureElementOptions, type StructureType, type SubsetCmap, type SubsetResult, type SvgDrawCommand, type SvgElement, type SvgRenderOptions, TextAlignment, type TextAnnotationIcon, type TextAppearanceOptions, type TextExtractionOptions, type TextItem, TextRenderingMode, type TilingPatternOptions, type TimestampResult, type TransparencyGroupOptions, type Type0FontData, UnexpectedFieldTypeError, type ViewerPreferences, type VisibleSignatureOptions, type WatermarkOptions, type WidgetAnnotationHost, type WidthEntry, addWatermark, addWatermarkToPage, aesDecryptCBC, aesEncryptCBC, annotationFromDict, applyFillColor, applyRedactions, applyStrokeColor, asNumber, asPDFName, asPDFNumber, attachFile, base64Decode, base64Encode, beginArtifact, beginArtifactWithType, beginLayerContent, beginMarkedContent, beginMarkedContentSequence, beginMarkedContentWithProperties, beginText, buildAnnotationDict, buildCatalog, buildDocumentStructure, buildEmbeddedFilesNameTree, buildGradientObjects, buildInfoDict, buildPageTree, buildPatternObjects, buildPkcs7Signature, buildTimestampRequest, buildViewerPreferencesDict, buildXmpMetadata, checkAccessibility, circlePath, clipEvenOdd, clip as clipOp, closeAndStroke, closeFillAndStroke, closeFillEvenOddAndStroke, closePath as closePathOp, cmyk, colorToComponents, componentsToColor, computeFileEncryptionKey, computeFontSize, computeImageDpi, computeSignatureHash, computeTargetDimensions, concatMatrix, concatMatrix as concatTransformationMatrix, convertToGrayscale, copyPages, createAnnotation, createMarkedContentScope, createPdf, createXmpStream, cropPage, curveToFinal, curveToInitial, curveTo as curveToOp, decodeImageStream, decodeJpegWasm, decodePermissions, decodeStream, deduplicateImages, degrees, degreesToRadians, downscaleImage, drawImageWithMatrix, drawImageXObject, drawXObject as drawObject, drawXObject, drawSvgOnPage, ellipsePath, embedPageAsFormXObject, embedSignature, encodeContextTag, encodeInteger, encodeJpegWasm, encodeLength, encodeOID, encodeOctetString, encodePermissions, encodePrintableString, encodeSequence, encodeSet, encodeUTCTime, encodeUtf8String, endArtifact, endLayerContent, endMarkedContent, endPath as endPathOp, endText, enforcePdfA, estimateJpegQuality, extractImages, extractMetrics, extractText, extractTextWithPositions, fillAndStroke as fillAndStrokeOp, fillEvenOdd, fillEvenOddAndStroke, fill as fillOp, findSignatures, formatHexContext, formatPdfDate, generateButtonAppearance, generateCheckboxAppearance, generateCircleAppearance, generateDropdownAppearance, generateFreeTextAppearance, generateHighlightAppearance, generateInkAppearance, generateLineAppearance, generateListboxAppearance, generateRadioAppearance, generateSignatureAppearance, generateSquareAppearance, generateSquigglyAppearance, generateStrikeOutAppearance, generateTextAppearance, generateUnderlineAppearance, getAttachments, getPageSize, getRedactionMarks, getSignatures, grayscale, initJpegWasm, initWasm, insertPage, isAccessible, isGrayscaleImage, isJpegWasmReady, isLinearized, isOpenTypeCFF, isTrueType, layoutCombedText, layoutMultilineText, layoutSinglelineText, lineTo as lineToOp, linearGradient, linearizePdf, loadPdf, markForRedaction, md5, mergePdfs, movePage, moveText as moveTextOp, moveTextSetLeading, moveTo as moveToOp, nextLine as nextLineOp, optimizeAllImages, optimizeImage, parseContentStream, parseSvg, parseSvgColor, parseSvgPath, parseSvgTransform, parseTimestampResponse, parseViewerPreferences, parseXmpMetadata, restoreState as popGraphicsState, restoreState, prepareForSigning, saveState as pushGraphicsState, saveState, radialGradient, radians, radiansToDegrees, rc4, recompressImage, rectangle as rectangleOp, removePage, removePages, requestTimestamp, resizePage, reversePages, rgb, rotateAllPages, rotate as rotateOp, rotatePage, rotationMatrix, saveDocumentIncremental, saveIncremental, scale as scaleOp, serializePdf, setCharacterSpacing as setCharacterSpacingOp, setCharacterSpacing as setCharacterSqueeze, setColorSpace, setDashPattern as setDashPatternOp, setFillColor, setFillColorCmyk, setFillColorGray, setFillColorRgb, setFillingColor, setFlatness, setFont as setFontAndSize, setFont as setFontOp, setFontSize as setFontSizeOp, setGraphicsState as setGraphicsStateOp, setLeading as setLeadingOp, setLeading as setLineHeight, setLineCap as setLineCapOp, setLineJoin as setLineJoinOp, setLineWidth as setLineWidthOp, setMiterLimit, setStrokeColor, setStrokeColorCmyk, setStrokeColorGray, setStrokeColorRgb, setStrokeColorSpace, setStrokingColor, setTextMatrix as setTextMatrixOp, setTextRenderingMode as setTextRenderingModeOp, setTextRise as setTextRiseOp, setWordSpacing as setWordSpacingOp, sha256, sha384, sha512, showTextArray, showTextHex, showTextNextLine, showText as showTextOp, showTextWithSpacing, signPdf, skew as skewOp, splitPdf, stroke as strokeOp, summarizeIssues, svgToPdfOperators, tilingPattern, translate as translateOp, validatePdfA, verifyOwnerPassword, verifySignature, verifySignatures, verifyUserPassword, wrapInMarkedContent };
|
|
8677
9151
|
//# sourceMappingURL=index.d.cts.map
|