pdf-lite 1.0.4 → 1.0.6
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/EXAMPLES.md +37 -87
- package/README.md +104 -144
- package/dist/acroform/acroform-manager.d.ts +49 -0
- package/dist/acroform/acroform-manager.js +215 -0
- package/dist/acroform/index.d.ts +1 -0
- package/dist/acroform/index.js +1 -0
- package/dist/core/generators.d.ts +2 -2
- package/dist/core/generators.js +3 -3
- package/dist/core/incremental-parser.d.ts +1 -1
- package/dist/core/incremental-parser.js +1 -1
- package/dist/core/objects/pdf-array.d.ts +3 -3
- package/dist/core/objects/pdf-array.js +4 -4
- package/dist/core/objects/pdf-boolean.d.ts +2 -2
- package/dist/core/objects/pdf-boolean.js +2 -2
- package/dist/core/objects/pdf-comment.d.ts +3 -3
- package/dist/core/objects/pdf-comment.js +4 -4
- package/dist/core/objects/pdf-date.d.ts +1 -1
- package/dist/core/objects/pdf-date.js +1 -1
- package/dist/core/objects/pdf-dictionary.d.ts +3 -3
- package/dist/core/objects/pdf-dictionary.js +5 -5
- package/dist/core/objects/pdf-hexadecimal.d.ts +3 -3
- package/dist/core/objects/pdf-hexadecimal.js +6 -6
- package/dist/core/objects/pdf-indirect-object.d.ts +5 -5
- package/dist/core/objects/pdf-indirect-object.js +9 -9
- package/dist/core/objects/pdf-name.d.ts +2 -2
- package/dist/core/objects/pdf-name.js +2 -2
- package/dist/core/objects/pdf-null.d.ts +2 -2
- package/dist/core/objects/pdf-null.js +2 -2
- package/dist/core/objects/pdf-number.d.ts +3 -3
- package/dist/core/objects/pdf-number.js +3 -3
- package/dist/core/objects/pdf-object-reference.d.ts +2 -2
- package/dist/core/objects/pdf-object-reference.js +2 -2
- package/dist/core/objects/pdf-start-xref.d.ts +4 -4
- package/dist/core/objects/pdf-start-xref.js +4 -4
- package/dist/core/objects/pdf-stream.d.ts +9 -8
- package/dist/core/objects/pdf-stream.js +39 -26
- package/dist/core/objects/pdf-string.d.ts +3 -3
- package/dist/core/objects/pdf-string.js +4 -4
- package/dist/core/objects/pdf-trailer.d.ts +8 -8
- package/dist/core/objects/pdf-trailer.js +6 -6
- package/dist/core/objects/pdf-xref-table.d.ts +7 -7
- package/dist/core/objects/pdf-xref-table.js +8 -8
- package/dist/core/serializer.d.ts +3 -3
- package/dist/core/serializer.js +2 -2
- package/dist/core/streams/object-stream.d.ts +3 -3
- package/dist/core/streams/object-stream.js +2 -2
- package/dist/core/tokens/boolean-token.d.ts +1 -1
- package/dist/core/tokens/boolean-token.js +1 -1
- package/dist/core/tokens/byte-offset-token.d.ts +2 -2
- package/dist/core/tokens/byte-offset-token.js +2 -2
- package/dist/core/tokens/comment-token.d.ts +2 -2
- package/dist/core/tokens/comment-token.js +4 -4
- package/dist/core/tokens/end-array-token.d.ts +1 -1
- package/dist/core/tokens/end-array-token.js +2 -2
- package/dist/core/tokens/end-dictionary-token.d.ts +1 -1
- package/dist/core/tokens/end-dictionary-token.js +2 -2
- package/dist/core/tokens/end-object-token.d.ts +1 -1
- package/dist/core/tokens/end-object-token.js +2 -2
- package/dist/core/tokens/end-stream-token.d.ts +2 -2
- package/dist/core/tokens/end-stream-token.js +2 -2
- package/dist/core/tokens/hexadecimal-token.d.ts +2 -2
- package/dist/core/tokens/hexadecimal-token.js +2 -2
- package/dist/core/tokens/name-token.d.ts +1 -1
- package/dist/core/tokens/name-token.js +2 -2
- package/dist/core/tokens/null-token.d.ts +1 -1
- package/dist/core/tokens/null-token.js +2 -2
- package/dist/core/tokens/number-token.d.ts +3 -3
- package/dist/core/tokens/number-token.js +3 -3
- package/dist/core/tokens/object-reference-token.d.ts +1 -1
- package/dist/core/tokens/object-reference-token.js +2 -2
- package/dist/core/tokens/start-array-token.d.ts +1 -1
- package/dist/core/tokens/start-array-token.js +2 -2
- package/dist/core/tokens/start-dictionary-token.d.ts +1 -1
- package/dist/core/tokens/start-dictionary-token.js +2 -2
- package/dist/core/tokens/start-object-token.d.ts +1 -1
- package/dist/core/tokens/start-object-token.js +2 -2
- package/dist/core/tokens/start-stream-token.d.ts +3 -3
- package/dist/core/tokens/start-stream-token.js +3 -3
- package/dist/core/tokens/start-xref-token.d.ts +1 -1
- package/dist/core/tokens/start-xref-token.js +2 -2
- package/dist/core/tokens/stream-chunk-token.d.ts +2 -2
- package/dist/core/tokens/stream-chunk-token.js +1 -1
- package/dist/core/tokens/string-token.d.ts +2 -2
- package/dist/core/tokens/string-token.js +3 -3
- package/dist/core/tokens/token.d.ts +1 -1
- package/dist/core/tokens/token.js +1 -1
- package/dist/core/tokens/trailer-token.d.ts +1 -1
- package/dist/core/tokens/trailer-token.js +2 -2
- package/dist/core/tokens/whitespace-token.d.ts +2 -2
- package/dist/core/tokens/whitespace-token.js +1 -1
- package/dist/core/tokens/xref-table-entry-token.d.ts +3 -3
- package/dist/core/tokens/xref-table-entry-token.js +2 -2
- package/dist/core/tokens/xref-table-section-start-token.d.ts +2 -2
- package/dist/core/tokens/xref-table-section-start-token.js +3 -3
- package/dist/core/tokens/xref-table-start-token.d.ts +1 -1
- package/dist/core/tokens/xref-table-start-token.js +2 -2
- package/dist/crypto/key-derivation/key-derivation-aes256.d.ts +1 -1
- package/dist/crypto/key-derivation/key-derivation-aes256.js +2 -2
- package/dist/crypto/key-gen/key-gen-rc4-128.d.ts +1 -1
- package/dist/crypto/key-gen/key-gen-rc4-128.js +5 -5
- package/dist/crypto/types.d.ts +1 -1
- package/dist/filters/asciihex.d.ts +1 -1
- package/dist/filters/asciihex.js +2 -2
- package/dist/filters/lzw.d.ts +1 -1
- package/dist/filters/types.d.ts +1 -1
- package/dist/pdf/pdf-document.d.ts +28 -14
- package/dist/pdf/pdf-document.js +60 -21
- package/dist/pdf/pdf-reader.d.ts +3 -3
- package/dist/pdf/pdf-reader.js +2 -2
- package/dist/pdf/pdf-revision.d.ts +5 -5
- package/dist/pdf/pdf-revision.js +4 -4
- package/dist/pdf/pdf-xref-lookup.d.ts +7 -7
- package/dist/pdf/pdf-xref-lookup.js +11 -10
- package/dist/security/crypt-filters/aesv2.d.ts +2 -2
- package/dist/security/crypt-filters/aesv2.js +2 -2
- package/dist/security/crypt-filters/aesv3.d.ts +2 -2
- package/dist/security/crypt-filters/aesv3.js +2 -2
- package/dist/security/crypt-filters/base.d.ts +4 -4
- package/dist/security/crypt-filters/base.js +3 -3
- package/dist/security/crypt-filters/identity.d.ts +2 -2
- package/dist/security/crypt-filters/identity.js +1 -1
- package/dist/security/crypt-filters/v2.d.ts +1 -1
- package/dist/security/crypt-filters/v2.js +1 -1
- package/dist/security/handlers/base.d.ts +4 -4
- package/dist/security/handlers/base.js +12 -12
- package/dist/security/handlers/pubSec.d.ts +3 -3
- package/dist/security/handlers/pubSec.js +10 -10
- package/dist/security/handlers/utils.d.ts +4 -4
- package/dist/security/handlers/utils.js +12 -12
- package/dist/security/handlers/v1.d.ts +4 -4
- package/dist/security/handlers/v1.js +7 -7
- package/dist/security/handlers/v2.d.ts +3 -3
- package/dist/security/handlers/v2.js +5 -5
- package/dist/security/handlers/v4.d.ts +6 -6
- package/dist/security/handlers/v4.js +11 -11
- package/dist/security/handlers/v5.d.ts +5 -5
- package/dist/security/handlers/v5.js +9 -9
- package/dist/security/types.d.ts +9 -9
- package/dist/signing/document-security-store.d.ts +11 -11
- package/dist/signing/document-security-store.js +4 -4
- package/dist/signing/signatures/adbe-pkcs7-detached.d.ts +4 -4
- package/dist/signing/signatures/adbe-pkcs7-detached.js +11 -11
- package/dist/signing/signatures/adbe-pkcs7-sha1.d.ts +4 -4
- package/dist/signing/signatures/adbe-pkcs7-sha1.js +12 -12
- package/dist/signing/signatures/adbe-x509-rsa-sha1.d.ts +4 -4
- package/dist/signing/signatures/adbe-x509-rsa-sha1.js +8 -8
- package/dist/signing/signatures/base.d.ts +5 -5
- package/dist/signing/signatures/base.js +11 -11
- package/dist/signing/signatures/etsi-cades-detached.d.ts +4 -4
- package/dist/signing/signatures/etsi-cades-detached.js +17 -17
- package/dist/signing/signatures/etsi-rfc3161.d.ts +2 -2
- package/dist/signing/signatures/etsi-rfc3161.js +9 -9
- package/dist/signing/signatures/index.d.ts +6 -6
- package/dist/signing/signatures/index.js +6 -6
- package/dist/signing/signer.d.ts +3 -3
- package/dist/signing/signer.js +10 -10
- package/dist/signing/types.d.ts +7 -7
- package/dist/signing/utils.d.ts +2 -2
- package/dist/signing/utils.js +1 -1
- package/dist/utils/algos.js +1 -1
- package/dist/utils/bytesToHex.d.ts +1 -1
- package/dist/utils/bytesToHex.js +2 -2
- package/dist/utils/bytesToHexBytes.d.ts +1 -1
- package/dist/utils/bytesToString.d.ts +1 -1
- package/dist/utils/concatUint8Arrays.d.ts +1 -1
- package/dist/utils/escapeString.d.ts +1 -1
- package/dist/utils/escapeString.js +1 -1
- package/dist/utils/hexBytesToBytes.d.ts +1 -1
- package/dist/utils/hexBytesToString.d.ts +1 -1
- package/dist/utils/hexToBytes.d.ts +1 -1
- package/dist/utils/hexToBytes.js +2 -2
- package/dist/utils/padBytes.d.ts +1 -1
- package/dist/utils/replaceInBuffer.d.ts +1 -1
- package/dist/utils/stringToBytes.d.ts +1 -1
- package/dist/utils/stringToHexBytes.d.ts +1 -1
- package/dist/utils/unescapeString.d.ts +1 -1
- package/dist/xfa/index.d.ts +1 -0
- package/dist/xfa/index.js +1 -0
- package/dist/xfa/xfa-manager.d.ts +44 -0
- package/dist/xfa/xfa-manager.js +138 -0
- package/package.json +3 -3
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { PdfEndStreamToken } from '../tokens/end-stream-token';
|
|
2
|
-
import { PdfStartStreamToken } from '../tokens/start-stream-token';
|
|
3
|
-
import { PdfStreamChunkToken } from '../tokens/stream-chunk-token';
|
|
4
|
-
import { PdfDictionary } from './pdf-dictionary';
|
|
5
|
-
import { PdfObject } from './pdf-object';
|
|
6
|
-
import { PdfName } from './pdf-name';
|
|
7
|
-
import { PdfArray } from './pdf-array';
|
|
8
|
-
import { flate } from '../../filters/flate';
|
|
9
|
-
import { asciiHex } from '../../filters/asciihex';
|
|
10
|
-
import { ascii85 } from '../../filters/ascii85';
|
|
11
|
-
import { lzw } from '../../filters/lzw';
|
|
12
|
-
import { runLength } from '../../filters/runlength';
|
|
13
|
-
import { passthroughFilter } from '../../filters/pass-through';
|
|
14
|
-
import { PdfNumber } from './pdf-number';
|
|
15
|
-
import { Predictor } from '../../utils/predictors';
|
|
16
|
-
import { bytesToPdfObjects } from '../generators';
|
|
17
|
-
import { PdfIndirectObject } from './pdf-indirect-object';
|
|
18
|
-
import { PdfXRefTableEntry } from './pdf-xref-table';
|
|
19
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
1
|
+
import { PdfEndStreamToken } from '../tokens/end-stream-token.js';
|
|
2
|
+
import { PdfStartStreamToken } from '../tokens/start-stream-token.js';
|
|
3
|
+
import { PdfStreamChunkToken } from '../tokens/stream-chunk-token.js';
|
|
4
|
+
import { PdfDictionary } from './pdf-dictionary.js';
|
|
5
|
+
import { PdfObject } from './pdf-object.js';
|
|
6
|
+
import { PdfName } from './pdf-name.js';
|
|
7
|
+
import { PdfArray } from './pdf-array.js';
|
|
8
|
+
import { flate } from '../../filters/flate.js';
|
|
9
|
+
import { asciiHex } from '../../filters/asciihex.js';
|
|
10
|
+
import { ascii85 } from '../../filters/ascii85.js';
|
|
11
|
+
import { lzw } from '../../filters/lzw.js';
|
|
12
|
+
import { runLength } from '../../filters/runlength.js';
|
|
13
|
+
import { passthroughFilter } from '../../filters/pass-through.js';
|
|
14
|
+
import { PdfNumber } from './pdf-number.js';
|
|
15
|
+
import { Predictor } from '../../utils/predictors.js';
|
|
16
|
+
import { bytesToPdfObjects } from '../generators.js';
|
|
17
|
+
import { PdfIndirectObject } from './pdf-indirect-object.js';
|
|
18
|
+
import { PdfXRefTableEntry } from './pdf-xref-table.js';
|
|
19
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
20
20
|
export class PdfStream extends PdfObject {
|
|
21
21
|
header;
|
|
22
22
|
original;
|
|
@@ -220,6 +220,12 @@ export class PdfStream extends PdfObject {
|
|
|
220
220
|
original: new Uint8Array(this.original),
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
|
+
static fromString(data) {
|
|
224
|
+
return new PdfStream({
|
|
225
|
+
original: stringToBytes(data),
|
|
226
|
+
header: new PdfDictionary(),
|
|
227
|
+
});
|
|
228
|
+
}
|
|
223
229
|
}
|
|
224
230
|
export class PdfObjStream extends PdfStream {
|
|
225
231
|
constructor(options) {
|
|
@@ -253,11 +259,20 @@ export class PdfObjStream extends PdfStream {
|
|
|
253
259
|
const reader = bytesToPdfObjects([decodedData]);
|
|
254
260
|
const numbers = [];
|
|
255
261
|
let i = 0;
|
|
262
|
+
const n = this.header.get('N');
|
|
263
|
+
const totalObjects = n ? n.value : 0;
|
|
256
264
|
while (true) {
|
|
257
265
|
const { value: obj, done } = reader.next();
|
|
258
266
|
if (done)
|
|
259
267
|
break;
|
|
260
|
-
if (obj instanceof
|
|
268
|
+
if (obj instanceof PdfNumber) {
|
|
269
|
+
// Collect object numbers and byte offsets
|
|
270
|
+
numbers.push(obj);
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
// This is an actual PDF object (can be Dictionary, Array, String, Name, etc.)
|
|
274
|
+
// The first N*2 numbers are: obj_num1 offset1 obj_num2 offset2 ...
|
|
275
|
+
// After that come the actual objects
|
|
261
276
|
const objectNumber = numbers[i * 2].value;
|
|
262
277
|
const generationNumber = 0;
|
|
263
278
|
yield new PdfIndirectObject({
|
|
@@ -266,12 +281,10 @@ export class PdfObjStream extends PdfStream {
|
|
|
266
281
|
content: obj,
|
|
267
282
|
});
|
|
268
283
|
i++;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
else {
|
|
274
|
-
throw new Error('Invalid object in PDF Object Stream');
|
|
284
|
+
// Stop after we've read N objects
|
|
285
|
+
if (totalObjects > 0 && i >= totalObjects) {
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
275
288
|
}
|
|
276
289
|
}
|
|
277
290
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ByteArray } from '../../types';
|
|
2
|
-
import { PdfStringToken } from '../tokens/string-token';
|
|
3
|
-
import { PdfObject } from './pdf-object';
|
|
1
|
+
import { ByteArray } from '../../types.js';
|
|
2
|
+
import { PdfStringToken } from '../tokens/string-token.js';
|
|
3
|
+
import { PdfObject } from './pdf-object.js';
|
|
4
4
|
export declare class PdfString extends PdfObject {
|
|
5
5
|
/**
|
|
6
6
|
* The raw bytes of the PDF string.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { bytesToString } from '../../utils/bytesToString';
|
|
2
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
3
|
-
import { PdfStringToken } from '../tokens/string-token';
|
|
4
|
-
import { PdfObject } from './pdf-object';
|
|
1
|
+
import { bytesToString } from '../../utils/bytesToString.js';
|
|
2
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
3
|
+
import { PdfStringToken } from '../tokens/string-token.js';
|
|
4
|
+
import { PdfObject } from './pdf-object.js';
|
|
5
5
|
export class PdfString extends PdfObject {
|
|
6
6
|
/**
|
|
7
7
|
* The raw bytes of the PDF string.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Ref } from '../ref';
|
|
2
|
-
import { PdfToken } from '../tokens/token';
|
|
3
|
-
import { PdfArray } from './pdf-array';
|
|
4
|
-
import { PdfDictionary } from './pdf-dictionary';
|
|
5
|
-
import { PdfHexadecimal } from './pdf-hexadecimal';
|
|
6
|
-
import { PdfNumber } from './pdf-number';
|
|
7
|
-
import { PdfObject } from './pdf-object';
|
|
8
|
-
import { PdfObjectReference } from './pdf-object-reference';
|
|
1
|
+
import { Ref } from '../ref.js';
|
|
2
|
+
import { PdfToken } from '../tokens/token.js';
|
|
3
|
+
import { PdfArray } from './pdf-array.js';
|
|
4
|
+
import { PdfDictionary } from './pdf-dictionary.js';
|
|
5
|
+
import { PdfHexadecimal } from './pdf-hexadecimal.js';
|
|
6
|
+
import { PdfNumber } from './pdf-number.js';
|
|
7
|
+
import { PdfObject } from './pdf-object.js';
|
|
8
|
+
import { PdfObjectReference } from './pdf-object-reference.js';
|
|
9
9
|
export type PdfTrailerEntries = {
|
|
10
10
|
Size: PdfNumber;
|
|
11
11
|
Root?: PdfObjectReference;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Ref } from '../ref';
|
|
2
|
-
import { PdfByteOffsetToken } from '../tokens/byte-offset-token';
|
|
3
|
-
import { PdfTrailerToken } from '../tokens/trailer-token';
|
|
4
|
-
import { PdfWhitespaceToken } from '../tokens/whitespace-token';
|
|
5
|
-
import { PdfDictionary } from './pdf-dictionary';
|
|
6
|
-
import { PdfObject } from './pdf-object';
|
|
1
|
+
import { Ref } from '../ref.js';
|
|
2
|
+
import { PdfByteOffsetToken } from '../tokens/byte-offset-token.js';
|
|
3
|
+
import { PdfTrailerToken } from '../tokens/trailer-token.js';
|
|
4
|
+
import { PdfWhitespaceToken } from '../tokens/whitespace-token.js';
|
|
5
|
+
import { PdfDictionary } from './pdf-dictionary.js';
|
|
6
|
+
import { PdfObject } from './pdf-object.js';
|
|
7
7
|
export class PdfTrailer extends PdfObject {
|
|
8
8
|
dict;
|
|
9
9
|
offset = new Ref(0);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Ref } from '../ref';
|
|
2
|
-
import { PdfXRefTableEntryToken } from '../tokens/xref-table-entry-token';
|
|
3
|
-
import { PdfXRefTableSectionStartToken } from '../tokens/xref-table-section-start-token';
|
|
4
|
-
import { PdfIndirectObject } from './pdf-indirect-object';
|
|
5
|
-
import { PdfNumber } from './pdf-number';
|
|
6
|
-
import { PdfObject } from './pdf-object';
|
|
1
|
+
import { Ref } from '../ref.js';
|
|
2
|
+
import { PdfXRefTableEntryToken } from '../tokens/xref-table-entry-token.js';
|
|
3
|
+
import { PdfXRefTableSectionStartToken } from '../tokens/xref-table-section-start-token.js';
|
|
4
|
+
import { PdfIndirectObject } from './pdf-indirect-object.js';
|
|
5
|
+
import { PdfNumber } from './pdf-number.js';
|
|
6
|
+
import { PdfObject } from './pdf-object.js';
|
|
7
7
|
export declare class PdfXRefTableEntry extends PdfObject {
|
|
8
8
|
objectNumber: PdfNumber;
|
|
9
9
|
generationNumber: PdfNumber;
|
|
@@ -42,7 +42,7 @@ export declare class PdfXRefTable extends PdfObject {
|
|
|
42
42
|
addEntryForObject(obj: PdfIndirectObject): void;
|
|
43
43
|
getEntry(objectNumber: number): PdfXRefTableEntry | undefined;
|
|
44
44
|
get lastSection(): PdfXRefTableSectionHeader | null;
|
|
45
|
-
protected tokenize(): import("
|
|
45
|
+
protected tokenize(): import("../index.js").PdfToken[];
|
|
46
46
|
private sortEntriesIntoSections;
|
|
47
47
|
clone(): this;
|
|
48
48
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Ref } from '../ref';
|
|
2
|
-
import { PdfByteOffsetToken } from '../tokens/byte-offset-token';
|
|
3
|
-
import { PdfWhitespaceToken } from '../tokens/whitespace-token';
|
|
4
|
-
import { PdfXRefTableEntryToken } from '../tokens/xref-table-entry-token';
|
|
5
|
-
import { PdfXRefTableSectionStartToken } from '../tokens/xref-table-section-start-token';
|
|
6
|
-
import { PdfXRefTableStartToken } from '../tokens/xref-table-start-token';
|
|
7
|
-
import { PdfNumber } from './pdf-number';
|
|
8
|
-
import { PdfObject } from './pdf-object';
|
|
1
|
+
import { Ref } from '../ref.js';
|
|
2
|
+
import { PdfByteOffsetToken } from '../tokens/byte-offset-token.js';
|
|
3
|
+
import { PdfWhitespaceToken } from '../tokens/whitespace-token.js';
|
|
4
|
+
import { PdfXRefTableEntryToken } from '../tokens/xref-table-entry-token.js';
|
|
5
|
+
import { PdfXRefTableSectionStartToken } from '../tokens/xref-table-section-start-token.js';
|
|
6
|
+
import { PdfXRefTableStartToken } from '../tokens/xref-table-start-token.js';
|
|
7
|
+
import { PdfNumber } from './pdf-number.js';
|
|
8
|
+
import { PdfObject } from './pdf-object.js';
|
|
9
9
|
export class PdfXRefTableEntry extends PdfObject {
|
|
10
10
|
objectNumber;
|
|
11
11
|
generationNumber;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ByteArray } from '../types';
|
|
2
|
-
import { Parser } from './parser';
|
|
3
|
-
import { PdfToken } from './tokens/token';
|
|
1
|
+
import { ByteArray } from '../types.js';
|
|
2
|
+
import { Parser } from './parser.js';
|
|
3
|
+
import { PdfToken } from './tokens/token.js';
|
|
4
4
|
/**
|
|
5
5
|
* Serializes PDF tokens into a byte stream.
|
|
6
6
|
* Handles byte offset calculation and token serialization.
|
package/dist/core/serializer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Parser } from './parser';
|
|
2
|
-
import { PdfByteOffsetToken } from './tokens/byte-offset-token';
|
|
1
|
+
import { Parser } from './parser.js';
|
|
2
|
+
import { PdfByteOffsetToken } from './tokens/byte-offset-token.js';
|
|
3
3
|
/**
|
|
4
4
|
* Serializes PDF tokens into a byte stream.
|
|
5
5
|
* Handles byte offset calculation and token serialization.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PdfObject } from '../objects/pdf-object';
|
|
2
|
-
import { ByteArray } from '../../types';
|
|
3
|
-
import { IterableReadableStream } from '../../utils/IterableReadableStream';
|
|
1
|
+
import { PdfObject } from '../objects/pdf-object.js';
|
|
2
|
+
import { ByteArray } from '../../types.js';
|
|
3
|
+
import { IterableReadableStream } from '../../utils/IterableReadableStream.js';
|
|
4
4
|
export declare class PdfObjectStream extends IterableReadableStream<PdfObject> {
|
|
5
5
|
constructor(input: AsyncIterable<ByteArray> | Iterable<ByteArray>);
|
|
6
6
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IterableReadableStream } from '../../utils/IterableReadableStream';
|
|
2
|
-
import { pdfDecoderAsync } from '../generators';
|
|
1
|
+
import { IterableReadableStream } from '../../utils/IterableReadableStream.js';
|
|
2
|
+
import { pdfDecoderAsync } from '../generators.js';
|
|
3
3
|
export class PdfObjectStream extends IterableReadableStream {
|
|
4
4
|
constructor(input) {
|
|
5
5
|
super({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PdfToken } from './token';
|
|
2
|
-
import { ByteArray } from '../../types';
|
|
1
|
+
import { PdfToken } from './token.js';
|
|
2
|
+
import { ByteArray } from '../../types.js';
|
|
3
3
|
export declare class PdfCommentToken extends PdfToken {
|
|
4
4
|
static EOF: PdfCommentToken;
|
|
5
5
|
comment: ByteArray;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
2
|
-
import { concatUint8Arrays } from '../../utils/concatUint8Arrays';
|
|
3
|
-
import { PdfToken } from './token';
|
|
4
|
-
import { bytesToString } from '../../utils/bytesToString';
|
|
1
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
2
|
+
import { concatUint8Arrays } from '../../utils/concatUint8Arrays.js';
|
|
3
|
+
import { PdfToken } from './token.js';
|
|
4
|
+
import { bytesToString } from '../../utils/bytesToString.js';
|
|
5
5
|
export class PdfCommentToken extends PdfToken {
|
|
6
6
|
static EOF = new PdfCommentToken('%EOF');
|
|
7
7
|
comment;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
2
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
2
|
+
import { PdfToken } from './token.js';
|
|
3
3
|
const END_ARRAY_BYTES = stringToBytes(']');
|
|
4
4
|
export class PdfEndArrayToken extends PdfToken {
|
|
5
5
|
constructor() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
2
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
2
|
+
import { PdfToken } from './token.js';
|
|
3
3
|
const END_DICTIONARY_BYTES = stringToBytes('>>');
|
|
4
4
|
export class PdfEndDictionaryToken extends PdfToken {
|
|
5
5
|
constructor() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
2
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
2
|
+
import { PdfToken } from './token.js';
|
|
3
3
|
const END_OBJECT_BYTES = stringToBytes('endobj');
|
|
4
4
|
export class PdfEndObjectToken extends PdfToken {
|
|
5
5
|
constructor() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
2
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
2
|
+
import { PdfToken } from './token.js';
|
|
3
3
|
const END_STREAM_BYTES = stringToBytes('endstream');
|
|
4
4
|
export class PdfEndStreamToken extends PdfToken {
|
|
5
5
|
constructor(bytes) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ByteArray } from '../../types';
|
|
2
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { ByteArray } from '../../types.js';
|
|
2
|
+
import { PdfToken } from './token.js';
|
|
3
3
|
export declare class PdfHexadecimalToken extends PdfToken {
|
|
4
4
|
raw: ByteArray;
|
|
5
5
|
constructor(hexadecimal: string | ByteArray);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
2
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
2
|
+
import { PdfToken } from './token.js';
|
|
3
3
|
export class PdfHexadecimalToken extends PdfToken {
|
|
4
4
|
raw;
|
|
5
5
|
constructor(hexadecimal) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
2
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
2
|
+
import { PdfToken } from './token.js';
|
|
3
3
|
export class PdfNameToken extends PdfToken {
|
|
4
4
|
name;
|
|
5
5
|
constructor(name) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
2
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
2
|
+
import { PdfToken } from './token.js';
|
|
3
3
|
const NULL = stringToBytes('null');
|
|
4
4
|
export class PdfNullToken extends PdfToken {
|
|
5
5
|
constructor() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ByteArray } from '../../types';
|
|
2
|
-
import { Ref } from '../ref';
|
|
3
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { ByteArray } from '../../types.js';
|
|
2
|
+
import { Ref } from '../ref.js';
|
|
3
|
+
import { PdfToken } from './token.js';
|
|
4
4
|
export declare class PdfNumberToken extends PdfToken {
|
|
5
5
|
#private;
|
|
6
6
|
padTo: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
2
|
-
import { Ref } from '../ref';
|
|
3
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
2
|
+
import { Ref } from '../ref.js';
|
|
3
|
+
import { PdfToken } from './token.js';
|
|
4
4
|
export class PdfNumberToken extends PdfToken {
|
|
5
5
|
#value;
|
|
6
6
|
padTo;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
2
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
2
|
+
import { PdfToken } from './token.js';
|
|
3
3
|
export class PdfObjectReferenceToken extends PdfToken {
|
|
4
4
|
objectNumber;
|
|
5
5
|
generationNumber;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
2
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
2
|
+
import { PdfToken } from './token.js';
|
|
3
3
|
const START_ARRAY_BYTES = stringToBytes('[');
|
|
4
4
|
export class PdfStartArrayToken extends PdfToken {
|
|
5
5
|
constructor() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
2
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
2
|
+
import { PdfToken } from './token.js';
|
|
3
3
|
const START_DICTIONARY_BYTES = stringToBytes('<<');
|
|
4
4
|
export class PdfStartDictionaryToken extends PdfToken {
|
|
5
5
|
constructor() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
2
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
2
|
+
import { PdfToken } from './token.js';
|
|
3
3
|
export class PdfStartObjectToken extends PdfToken {
|
|
4
4
|
objectNumber;
|
|
5
5
|
generationNumber;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ByteArray } from '../../types';
|
|
2
|
-
import { PdfToken } from './token';
|
|
3
|
-
import { PdfWhitespaceToken } from './whitespace-token';
|
|
1
|
+
import { ByteArray } from '../../types.js';
|
|
2
|
+
import { PdfToken } from './token.js';
|
|
3
|
+
import { PdfWhitespaceToken } from './whitespace-token.js';
|
|
4
4
|
export declare class PdfStartStreamToken extends PdfToken {
|
|
5
5
|
constructor(bytes?: ByteArray);
|
|
6
6
|
getTrailingWhitespaceTokens(): PdfWhitespaceToken[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
2
|
-
import { PdfToken } from './token';
|
|
3
|
-
import { PdfWhitespaceToken } from './whitespace-token';
|
|
1
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
2
|
+
import { PdfToken } from './token.js';
|
|
3
|
+
import { PdfWhitespaceToken } from './whitespace-token.js';
|
|
4
4
|
const START_STREAM_WITHOUT_WHITESPACE_BYTES = stringToBytes('stream');
|
|
5
5
|
const START_STREAM_BYTES = stringToBytes('stream\n');
|
|
6
6
|
export class PdfStartStreamToken extends PdfToken {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
2
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
2
|
+
import { PdfToken } from './token.js';
|
|
3
3
|
const START_XREF = stringToBytes('startxref');
|
|
4
4
|
export class PdfStartXRefToken extends PdfToken {
|
|
5
5
|
constructor() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ByteArray } from '../../types';
|
|
2
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { ByteArray } from '../../types.js';
|
|
2
|
+
import { PdfToken } from './token.js';
|
|
3
3
|
export declare class PdfStringToken extends PdfToken {
|
|
4
4
|
value: ByteArray;
|
|
5
5
|
constructor(value: string | ByteArray);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { escapeString } from '../../utils/escapeString';
|
|
2
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
3
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { escapeString } from '../../utils/escapeString.js';
|
|
2
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
3
|
+
import { PdfToken } from './token.js';
|
|
4
4
|
export class PdfStringToken extends PdfToken {
|
|
5
5
|
value;
|
|
6
6
|
constructor(value) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { stringToBytes } from '../../utils/stringToBytes';
|
|
2
|
-
import { PdfToken } from './token';
|
|
1
|
+
import { stringToBytes } from '../../utils/stringToBytes.js';
|
|
2
|
+
import { PdfToken } from './token.js';
|
|
3
3
|
const TRAILER = stringToBytes('trailer');
|
|
4
4
|
export class PdfTrailerToken extends PdfToken {
|
|
5
5
|
byteOffset;
|