@libpdf/core 0.2.7 → 0.2.9
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/dist/index.d.mts +30 -1
- package/dist/index.mjs +309 -257
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -1
package/dist/index.d.mts
CHANGED
|
@@ -182,6 +182,8 @@ declare class PdfName implements PdfPrimitive {
|
|
|
182
182
|
static readonly Length: PdfName;
|
|
183
183
|
static readonly Filter: PdfName;
|
|
184
184
|
static readonly FlateDecode: PdfName;
|
|
185
|
+
/** Cached serialized form (e.g. "/Type"). Computed lazily on first toBytes(). */
|
|
186
|
+
private cachedBytes;
|
|
185
187
|
private constructor();
|
|
186
188
|
/**
|
|
187
189
|
* Get or create an interned PdfName for the given string.
|
|
@@ -1631,6 +1633,11 @@ declare class Operator {
|
|
|
1631
1633
|
* Create an operator with operands.
|
|
1632
1634
|
*/
|
|
1633
1635
|
static of(op: Op, ...operands: Operand[]): Operator;
|
|
1636
|
+
/**
|
|
1637
|
+
* Write operator bytes directly into a shared ByteWriter.
|
|
1638
|
+
* Avoids intermediate allocations compared to toBytes().
|
|
1639
|
+
*/
|
|
1640
|
+
writeTo(writer: ByteWriter): void;
|
|
1634
1641
|
/**
|
|
1635
1642
|
* Serialize to bytes for content stream output.
|
|
1636
1643
|
* Format: "operand1 operand2 ... operator"
|
|
@@ -1642,7 +1649,9 @@ declare class Operator {
|
|
|
1642
1649
|
*/
|
|
1643
1650
|
toString(): string;
|
|
1644
1651
|
/**
|
|
1645
|
-
* Get byte length when serialized
|
|
1652
|
+
* Get byte length when serialized.
|
|
1653
|
+
*
|
|
1654
|
+
* Should be avoided in performance-critical paths, use {@link writeTo} instead.
|
|
1646
1655
|
*/
|
|
1647
1656
|
byteLength(): number;
|
|
1648
1657
|
}
|
|
@@ -4966,6 +4975,8 @@ interface ExtractedChar {
|
|
|
4966
4975
|
fontName: string;
|
|
4967
4976
|
/** Y coordinate of the text baseline */
|
|
4968
4977
|
baseline: number;
|
|
4978
|
+
/** Index in the content stream extraction order (0-based) */
|
|
4979
|
+
sequenceIndex?: number;
|
|
4969
4980
|
}
|
|
4970
4981
|
/**
|
|
4971
4982
|
* A span of text with the same font and size on the same line.
|
|
@@ -8727,6 +8738,24 @@ interface SaveOptions {
|
|
|
8727
8738
|
* @default false
|
|
8728
8739
|
*/
|
|
8729
8740
|
subsetFonts?: boolean;
|
|
8741
|
+
/**
|
|
8742
|
+
* Compress uncompressed streams with FlateDecode (default: true).
|
|
8743
|
+
*
|
|
8744
|
+
* When enabled, streams without a /Filter entry will be compressed
|
|
8745
|
+
* before writing. Streams that already have filters (including image
|
|
8746
|
+
* formats like DCTDecode/JPXDecode) are left unchanged.
|
|
8747
|
+
*/
|
|
8748
|
+
compressStreams?: boolean;
|
|
8749
|
+
/**
|
|
8750
|
+
* Minimum stream size in bytes to attempt compression (default: 512).
|
|
8751
|
+
*
|
|
8752
|
+
* Streams smaller than this threshold are written uncompressed.
|
|
8753
|
+
* Deflate initialization has a fixed overhead that dominates for small
|
|
8754
|
+
* payloads, and tiny streams rarely achieve meaningful compression.
|
|
8755
|
+
*
|
|
8756
|
+
* Set to 0 to compress all streams regardless of size.
|
|
8757
|
+
*/
|
|
8758
|
+
compressionThreshold?: number;
|
|
8730
8759
|
}
|
|
8731
8760
|
/**
|
|
8732
8761
|
* Options for adding a new page.
|