muhammara 2.4.0 → 2.5.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/CHANGELOG.md +10 -1
- package/muhammara.d.ts +258 -241
- package/muhammara.js +1 -1
- package/node_modules/minipass/LICENSE +1 -1
- package/node_modules/minipass/README.md +122 -7
- package/node_modules/minipass/index.d.ts +149 -0
- package/node_modules/minipass/index.js +191 -102
- package/node_modules/minipass/package.json +23 -7
- package/node_modules/tr46/package.json +1 -1
- package/node_modules/util-deprecate/package.json +1 -1
- package/node_modules/webidl-conversions/package.json +1 -1
- package/node_modules/whatwg-url/package.json +1 -1
- package/node_modules/wrappy/package.json +1 -1
- package/package.json +2 -1
- package/src/DocumentCopyingContextDriver.cpp +9 -9
- package/src/ObjectsContextDriver.cpp +1 -1
package/muhammara.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
declare module 'muhammara' {
|
|
2
|
+
import EventEmitter = require("events");
|
|
2
3
|
export type PosX = number;
|
|
3
4
|
export type PosY = number;
|
|
4
5
|
export type Width = number;
|
|
@@ -39,10 +40,10 @@ declare module 'muhammara' {
|
|
|
39
40
|
options?: PDFRecryptOptions,
|
|
40
41
|
): void;
|
|
41
42
|
export function recrypt(
|
|
42
|
-
originalPdfStream:
|
|
43
|
-
newPdfStream:
|
|
43
|
+
originalPdfStream: PDFRStreamForFile,
|
|
44
|
+
newPdfStream: PDFWStreamForFile,
|
|
44
45
|
options?: PDFRecryptOptions,
|
|
45
|
-
): void;
|
|
46
|
+
): void;
|
|
46
47
|
|
|
47
48
|
export interface WriteStream {
|
|
48
49
|
write(inBytesArray: any[]): number;
|
|
@@ -87,8 +88,10 @@ declare module 'muhammara' {
|
|
|
87
88
|
writePage(): this;
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
export type PDFImageType = 'JPG' | 'PDF' | 'PNG' | 'TIFF'
|
|
92
|
+
|
|
90
93
|
export interface PDFRStreamForFile extends ReadStream {
|
|
91
|
-
new (inPath:
|
|
94
|
+
new (inPath: FilePath): PDFRStreamForFile;
|
|
92
95
|
close(inCallback?: () => void): void;
|
|
93
96
|
}
|
|
94
97
|
|
|
@@ -106,6 +109,36 @@ declare module 'muhammara' {
|
|
|
106
109
|
width?: number;
|
|
107
110
|
close?: boolean;
|
|
108
111
|
}
|
|
112
|
+
export type TransformationMatrix = [a: number, b: number, c: number, d: number, e: number, f: number]
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
enum LineJoinStyle {
|
|
116
|
+
LINEJOIN_ROUND,
|
|
117
|
+
LINEJOIN_BEVEL,
|
|
118
|
+
LINEJOIN_MITER_VARIABLE,
|
|
119
|
+
LINEJOIN_MITER = 2,
|
|
120
|
+
LINEJOIN_MITER_FIXED = 3
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
enum EEncoding
|
|
124
|
+
{
|
|
125
|
+
EEncodingText = 'text',
|
|
126
|
+
EEncodingCode = 'code',
|
|
127
|
+
EEncodingHex = 'hex'
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
enum LineCapStyle {
|
|
131
|
+
LINECAP_BUTT = 0,
|
|
132
|
+
LINECAP_ROUND,
|
|
133
|
+
LINECAP_SQUARE
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface TextRenderOptions {
|
|
137
|
+
encoding?: EEncoding
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export type Glyph = Array<[number, number]>;
|
|
141
|
+
|
|
109
142
|
|
|
110
143
|
export interface AbstractContentContext {
|
|
111
144
|
b(): this;
|
|
@@ -118,13 +151,13 @@ declare module 'muhammara' {
|
|
|
118
151
|
F(): this;
|
|
119
152
|
fStar(): this;
|
|
120
153
|
n(): this;
|
|
121
|
-
m(x:
|
|
122
|
-
l(x:
|
|
123
|
-
c(x1:
|
|
124
|
-
v(x2:
|
|
125
|
-
y(x1:
|
|
154
|
+
m(x: PosX, y: PosY): this;
|
|
155
|
+
l(x: PosX, y: PosY): this;
|
|
156
|
+
c(x1: PosX, y1: PosY, x2: PosX, y2: PosY, x3: PosX, y3: PosY): number;
|
|
157
|
+
v(x2: PosX, y2: PosY, x3: PosX, y3: PosY): this;
|
|
158
|
+
y(x1: PosX, y1: PosY, x3: PosX, y3: PosY): this;
|
|
126
159
|
h(): this;
|
|
127
|
-
re(left: number, bottom: number, width:
|
|
160
|
+
re(left: number, bottom: number, width: Width, height: Height): this;
|
|
128
161
|
q(): this;
|
|
129
162
|
Q(): this;
|
|
130
163
|
/**
|
|
@@ -132,10 +165,10 @@ declare module 'muhammara' {
|
|
|
132
165
|
* c d 0
|
|
133
166
|
* e f 1
|
|
134
167
|
*/
|
|
135
|
-
cm(
|
|
136
|
-
w(lineWidth:
|
|
137
|
-
J(lineCapStyle:
|
|
138
|
-
j(lineJoinStyle:
|
|
168
|
+
cm(...args: TransformationMatrix): this;
|
|
169
|
+
w(lineWidth: Width): this;
|
|
170
|
+
J(lineCapStyle: LineCapStyle): this;
|
|
171
|
+
j(lineJoinStyle: LineJoinStyle): this;
|
|
139
172
|
M(miterLimit: number): this;
|
|
140
173
|
d(miterLimit: number[], dashPhase: number): this;
|
|
141
174
|
ri(renderingIntentName: string): this;
|
|
@@ -157,7 +190,7 @@ declare module 'muhammara' {
|
|
|
157
190
|
k(c: number, m: number, y: number, k: number): this;
|
|
158
191
|
W(): this;
|
|
159
192
|
WStar(): this;
|
|
160
|
-
doXObject(xObject: string |
|
|
193
|
+
doXObject(xObject: string | FormXObject | ImageXObject): this;
|
|
161
194
|
Tc(characterSpace: number): this;
|
|
162
195
|
Tw(wordSpace: number): this;
|
|
163
196
|
Tz(horizontalScaling: number): this;
|
|
@@ -171,18 +204,18 @@ declare module 'muhammara' {
|
|
|
171
204
|
Tm(a: number, b: number, c: number, d: number, e: number, f: number): this;
|
|
172
205
|
TStar(): this;
|
|
173
206
|
Tf(fontReferenced: UsedFont | string, fontSize: number): this;
|
|
174
|
-
Tj(text: string |
|
|
175
|
-
Quote(text: string |
|
|
176
|
-
DoubleQuote(wordSpacing: number, characterString: number, text: string |
|
|
177
|
-
TJ(
|
|
207
|
+
Tj(text: string | Glyph): this;
|
|
208
|
+
Quote(text: string | Glyph): this;
|
|
209
|
+
DoubleQuote(wordSpacing: number, characterString: number, text: string | Glyph): this;
|
|
210
|
+
TJ(value: string | Glyph, options?: TextRenderOptions): this;
|
|
178
211
|
writeFreeCode(freeCode: string): this;
|
|
179
212
|
drawPath(...parameters: any[]): this; // This can't be materialized in TypeScript
|
|
180
213
|
////drawPath(...xyPairs: number[], options: GraphicOptions): this;
|
|
181
|
-
drawCircle(x:
|
|
182
|
-
drawSquare(x:
|
|
183
|
-
drawRectangle(x:
|
|
184
|
-
writeText(text: string, x:
|
|
185
|
-
drawImage(x:
|
|
214
|
+
drawCircle(x: PosX, y: PosY, r: number, options: GraphicOptions): this;
|
|
215
|
+
drawSquare(x: PosX, y: PosY, l: number, options: GraphicOptions): this;
|
|
216
|
+
drawRectangle(x: PosX, y: PosY, w: number, h: number, options: GraphicOptions): this;
|
|
217
|
+
writeText(text: string, x: PosX, y: PosY, options?: WriteTextOptions): this;
|
|
218
|
+
drawImage(x: PosX, y: PosY, imagePath: string, options?: ImageOptions): this;
|
|
186
219
|
}
|
|
187
220
|
|
|
188
221
|
export interface TransformationObject {
|
|
@@ -215,7 +248,7 @@ declare module 'muhammara' {
|
|
|
215
248
|
}
|
|
216
249
|
|
|
217
250
|
export interface PDFStreamForResponse extends WriteStream {
|
|
218
|
-
new (res:
|
|
251
|
+
new (res: PDFRStreamForFile): PDFStreamForResponse;
|
|
219
252
|
}
|
|
220
253
|
|
|
221
254
|
export interface PDFWStreamForBuffer extends WriteStream {
|
|
@@ -233,7 +266,7 @@ declare module 'muhammara' {
|
|
|
233
266
|
|
|
234
267
|
export interface PDFWriterToContinueOptions {
|
|
235
268
|
modifiedFilePath?: string;
|
|
236
|
-
|
|
269
|
+
modifiedStream?: PDFRStreamForFile; // TODO
|
|
237
270
|
log?: string;
|
|
238
271
|
}
|
|
239
272
|
|
|
@@ -272,6 +305,10 @@ declare module 'muhammara' {
|
|
|
272
305
|
export const ePDFPageBoxArtBox = 4;
|
|
273
306
|
export type PDFPageBoxType = 0 | 1 | 2 | 3 | 4;
|
|
274
307
|
|
|
308
|
+
export const eRangeTypeAll = 0;
|
|
309
|
+
export const eRangeTypeSpecific = 1;
|
|
310
|
+
export type eRangeType = 0 | 1;
|
|
311
|
+
|
|
275
312
|
export interface PDFWriterOptions {
|
|
276
313
|
version?: EPDFVersion;
|
|
277
314
|
log?: string;
|
|
@@ -289,18 +326,17 @@ declare module 'muhammara' {
|
|
|
289
326
|
}
|
|
290
327
|
|
|
291
328
|
export interface ResourcesDictionary {
|
|
292
|
-
addFormXObjectMapping(formXObject: FormXObject):
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
*/
|
|
329
|
+
addFormXObjectMapping(formXObject: FormXObject): string;
|
|
330
|
+
addImageXObjectMapping(imageXObject: ImageXObject|number): string;
|
|
331
|
+
addProcsetResource(procSetName: string): void;
|
|
332
|
+
addExtGStateMapping(stateObjectId: number): string;
|
|
333
|
+
addFontMapping(fontObjectId: number): string;
|
|
334
|
+
addColorSpaceMapping(colorSpaceId: number): string;
|
|
335
|
+
addPatternMapping(colorSpaceId: number): string;
|
|
336
|
+
addPatternMapping(patternObjectId: number): string;
|
|
337
|
+
addPropertyMapping(propertyObjectId: number): string;
|
|
338
|
+
addXObjectMapping(xObjectId: number): string;
|
|
339
|
+
addShadingMapping(xObjectId: number): string;
|
|
304
340
|
}
|
|
305
341
|
|
|
306
342
|
export type PDFBox = [PosX, PosY, Width, Height];
|
|
@@ -313,16 +349,6 @@ declare module 'muhammara' {
|
|
|
313
349
|
artBox?: PDFBox;
|
|
314
350
|
rotate?: number;
|
|
315
351
|
getResourcesDictionary(): ResourcesDictionary;
|
|
316
|
-
|
|
317
|
-
/*
|
|
318
|
-
SET_ACCESSOR_METHODS(t, "mediaBox", GetMediaBox, SetMediaBox);
|
|
319
|
-
SET_ACCESSOR_METHODS(t, "cropBox", GetCropBox, SetCropBox);
|
|
320
|
-
SET_ACCESSOR_METHODS(t, "bleedBox", GetBleedBox, SetBleedBox);
|
|
321
|
-
SET_ACCESSOR_METHODS(t, "trimBox", GetTrimBox, SetTrimBox);
|
|
322
|
-
SET_ACCESSOR_METHODS(t, "artBox", GetArtBox, SetArtBox);
|
|
323
|
-
SET_ACCESSOR_METHODS(t, "rotate",GetRotate, SetRotate);
|
|
324
|
-
SET_PROTOTYPE_METHOD(t, "getResourcesDictionary", GetResourcesDictionary);
|
|
325
|
-
*/
|
|
326
352
|
}
|
|
327
353
|
|
|
328
354
|
export interface TextDimension {
|
|
@@ -348,21 +374,17 @@ declare module 'muhammara' {
|
|
|
348
374
|
}
|
|
349
375
|
|
|
350
376
|
export interface ByteReader {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
SET_PROTOTYPE_METHOD(t, "notEnded", NotEnded);
|
|
354
|
-
*/
|
|
377
|
+
read(length: number): Array<number>;
|
|
378
|
+
notEnded(): boolean;
|
|
355
379
|
}
|
|
356
380
|
|
|
357
381
|
export interface ByteReaderWithPosition {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
SET_PROTOTYPE_METHOD(t, "skip", Skip);
|
|
365
|
-
*/
|
|
382
|
+
read(length: number): Array<number>;
|
|
383
|
+
notEnded(): boolean;
|
|
384
|
+
getCurrentPosition(): number;
|
|
385
|
+
skip(length: number): this;
|
|
386
|
+
setPosition(position: number): this;
|
|
387
|
+
setPositionFromEnd(position: number): this;
|
|
366
388
|
}
|
|
367
389
|
|
|
368
390
|
export interface PDFReader {
|
|
@@ -370,24 +392,19 @@ declare module 'muhammara' {
|
|
|
370
392
|
getPagesCount(): number;
|
|
371
393
|
getTrailer(): PDFDictionary;
|
|
372
394
|
queryDictionaryObject(dictionary: PDFDictionary, name: string): PDFObject;
|
|
373
|
-
|
|
374
|
-
SET_PROTOTYPE_METHOD(t, "queryArrayObject", QueryArrayObject);
|
|
375
|
-
*/
|
|
395
|
+
queryArrayObject(objectList: PDFArray, index: number): undefined|PDFObject;
|
|
376
396
|
parseNewObject(objectId: number): PDFObject;
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
SET_PROTOTYPE_METHOD(t, "parsePageDictionary", ParsePageDictionary);
|
|
380
|
-
*/
|
|
397
|
+
getPageObjectID(objectId: number): number;
|
|
398
|
+
parsePageDictionary(objectId: number): PDFDictionary;
|
|
381
399
|
parsePage(page: number): PDFPageInput;
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
*/
|
|
400
|
+
getObjectsCount(): number;
|
|
401
|
+
isEncrypted(): boolean;
|
|
402
|
+
getXrefSize(): number;
|
|
403
|
+
getXrefEntry(objectId: number): { objectPosition: number, revision: number, type: number };
|
|
404
|
+
getXrefSize(): number;
|
|
405
|
+
getXrefPosition(objectId: number): number;
|
|
406
|
+
startReadingFromStream(inputStream: PDFStreamInput): ByteReader;
|
|
407
|
+
getParserStream(): ByteReaderWithPosition;
|
|
391
408
|
}
|
|
392
409
|
|
|
393
410
|
export interface PDFStream {
|
|
@@ -395,15 +412,11 @@ declare module 'muhammara' {
|
|
|
395
412
|
}
|
|
396
413
|
|
|
397
414
|
export interface PDFNull extends PDFObject {
|
|
398
|
-
|
|
399
|
-
SET_ACCESSOR_METHOD(t, "value", GetValue);
|
|
400
|
-
*/
|
|
415
|
+
value: void;
|
|
401
416
|
}
|
|
402
417
|
|
|
403
418
|
export interface PDFName extends PDFObject {
|
|
404
|
-
|
|
405
|
-
SET_ACCESSOR_METHOD(t, "value", GetValue);
|
|
406
|
-
*/
|
|
419
|
+
value: string;
|
|
407
420
|
}
|
|
408
421
|
|
|
409
422
|
export interface PDFLiteralString extends PDFObject {
|
|
@@ -412,9 +425,7 @@ declare module 'muhammara' {
|
|
|
412
425
|
}
|
|
413
426
|
|
|
414
427
|
export interface PDFInteger extends PDFObject {
|
|
415
|
-
|
|
416
|
-
SET_ACCESSOR_METHOD(t, "value", GetValue);
|
|
417
|
-
*/
|
|
428
|
+
value: number;
|
|
418
429
|
}
|
|
419
430
|
|
|
420
431
|
export interface PDFIndirectObjectReference extends PDFObject {
|
|
@@ -423,9 +434,7 @@ declare module 'muhammara' {
|
|
|
423
434
|
}
|
|
424
435
|
|
|
425
436
|
export interface PDFHexString extends PDFObject {
|
|
426
|
-
|
|
427
|
-
SET_ACCESSOR_METHOD(t, "value", GetValue);
|
|
428
|
-
*/
|
|
437
|
+
value: string;
|
|
429
438
|
}
|
|
430
439
|
|
|
431
440
|
export interface PDFDictionary extends PDFObject {
|
|
@@ -435,151 +444,145 @@ declare module 'muhammara' {
|
|
|
435
444
|
}
|
|
436
445
|
|
|
437
446
|
export interface PDFDate {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
SET_PROTOTYPE_METHOD(t, "setToCurrentTime", SetToCurrentTime);
|
|
441
|
-
*/
|
|
447
|
+
toString(): string;
|
|
448
|
+
setToCurrentTime(): this;
|
|
442
449
|
}
|
|
443
450
|
|
|
444
451
|
export interface PDFBoolean extends PDFObject {
|
|
445
|
-
|
|
446
|
-
SET_ACCESSOR_METHOD(t, "value", GetValue);
|
|
447
|
-
*/
|
|
452
|
+
value: boolean;
|
|
448
453
|
}
|
|
449
454
|
|
|
450
455
|
export interface PDFArray extends PDFObject {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
SET_PROTOTYPE_METHOD(t, "getLength", GetLength);
|
|
455
|
-
*/
|
|
456
|
+
toJSArray(): Array<any>;
|
|
457
|
+
queryObject(index: number): any;
|
|
458
|
+
getLength(): number;
|
|
456
459
|
}
|
|
457
460
|
|
|
458
461
|
export interface OutputFile {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
SET_PROTOTYPE_METHOD(t, "getOutputStream", GetOutputStream);
|
|
464
|
-
*/
|
|
462
|
+
openFile(filePath: FilePath, append?: boolean): void;
|
|
463
|
+
closeFile(): void;
|
|
464
|
+
getFilePath(): string|undefined;
|
|
465
|
+
getOutputStream(): ByteWriterWithPosition|undefined;
|
|
465
466
|
}
|
|
466
467
|
|
|
467
468
|
export interface InputFile {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
SET_PROTOTYPE_METHOD(t, "getInputStream", GetInputStream);
|
|
474
|
-
*/
|
|
469
|
+
openFile(filePath: FilePath): void;
|
|
470
|
+
closeFile(): void;
|
|
471
|
+
getFilePath(): string|undefined;
|
|
472
|
+
getFileSize(): number|undefined;
|
|
473
|
+
getInputStream(): ByteReaderWithPosition|undefined;
|
|
475
474
|
}
|
|
476
475
|
|
|
476
|
+
export enum EInfoTrapped {
|
|
477
|
+
EInfoTrappedTrue,
|
|
478
|
+
EInfoTrappedFalse,
|
|
479
|
+
EInfoTrappedUnknown
|
|
480
|
+
}
|
|
481
|
+
|
|
477
482
|
export interface InfoDictionary {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
*/
|
|
483
|
+
addAdditionalInfoEntry(key: string, value: string): void;
|
|
484
|
+
removeAdditionalInfoEntry(key: string): void;
|
|
485
|
+
clearAdditionalInfoEntries(): void;
|
|
486
|
+
getAdditionalInfoEntry(key: string): string;
|
|
487
|
+
getAdditionalInfoEntries(key: string): {[key: string]: string}
|
|
488
|
+
setCreationDate(date: string | Date): void;
|
|
489
|
+
setModDate(date: string | Date): void;
|
|
490
|
+
|
|
491
|
+
title: string;
|
|
492
|
+
author: string;
|
|
493
|
+
subject: string;
|
|
494
|
+
keywords: string;
|
|
495
|
+
creator: string;
|
|
496
|
+
producer: string;
|
|
497
|
+
trapped: EInfoTrapped;
|
|
494
498
|
}
|
|
495
499
|
|
|
496
500
|
export interface ImageXObject {
|
|
497
|
-
|
|
498
|
-
SET_ACCESSOR_METHOD(t, "id", GetID);
|
|
499
|
-
*/
|
|
501
|
+
id: number;
|
|
500
502
|
}
|
|
501
503
|
|
|
502
504
|
export interface FormObject {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
SET_PROTOTYPE_METHOD(t, "getContentStream", GetContentStream);
|
|
508
|
-
*/
|
|
505
|
+
id: number;
|
|
506
|
+
getContentContext(): XObjectContentContext;
|
|
507
|
+
getResourcesDictinary(): ResourcesDictionary;
|
|
508
|
+
getContentStream(): PDFStream;
|
|
509
509
|
}
|
|
510
510
|
|
|
511
511
|
export interface DocumentCopyingContext {
|
|
512
512
|
createFormXObjectFromPDFPage(
|
|
513
513
|
sourcePageIndex: number,
|
|
514
514
|
ePDFPageBox: PDFPageBoxType | PDFBox,
|
|
515
|
+
transformation?: TransformationMatrix
|
|
515
516
|
): number;
|
|
516
517
|
mergePDFPageToPage(target: PDFPage, sourcePageIndex: number): void;
|
|
517
518
|
appendPDFPageFromPDF(sourcePageNumber: number): number; // stream start bytes?
|
|
518
|
-
mergePDFPageToFormXObject(sourcePage: PDFPage, targetPageNumber: number):
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
SET_PROTOTYPE_METHOD(t, "getSourceDocumentStream", GetSourceDocumentStream);
|
|
529
|
-
*/
|
|
519
|
+
mergePDFPageToFormXObject(sourcePage: PDFPage, targetPageNumber: number): void;
|
|
520
|
+
getSourceDocumentParser(input: FilePath | ReadStream, options?: PDFReaderOptions): PDFReader;
|
|
521
|
+
copyDirectObjectAsIs(objectToCopy: PDFObject): void;
|
|
522
|
+
copyObject(objectId: number): number;
|
|
523
|
+
copyDirectObjectWithDeepCopy(objectToCopy: PDFObject): Array<number>;
|
|
524
|
+
copyNewObjectsForDirectObject(objectIds: Array<number>): void;
|
|
525
|
+
getCopiedObjectID(objectId: number): number;
|
|
526
|
+
getCopiedObjects(): {[key: string]: number};
|
|
527
|
+
replaceSourceObjects(replaceMap: {[key: string]: number}): void;
|
|
528
|
+
getSourceDocumentStream(): ByteReaderWithPosition;
|
|
530
529
|
}
|
|
531
530
|
|
|
532
531
|
export interface DocumentContext {
|
|
533
|
-
|
|
534
|
-
SET_PROTOTYPE_METHOD(t, "getInfoDictionary", GetInfoDictionary);
|
|
535
|
-
*/
|
|
532
|
+
getInfoDictionary(): InfoDictionary;
|
|
536
533
|
}
|
|
537
534
|
|
|
538
535
|
export interface DictionaryContext {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
*/
|
|
536
|
+
writeKey(): DictionaryContext;
|
|
537
|
+
writeNameValue(nameValue: string): this;
|
|
538
|
+
writeRectangleValue(values: Array<number>): this;
|
|
539
|
+
writeRectangleValue(a: number, b: number, c: number, d: number): this;
|
|
540
|
+
writeLiteralStringValue(literal: Array<number>|string): this;
|
|
541
|
+
writeBooleanValue(boolValue: boolean): this;
|
|
542
|
+
writeObjectReferenceValue(objectId: number): this;
|
|
547
543
|
}
|
|
548
544
|
|
|
549
545
|
export interface ByteWriterWithPosition {
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
546
|
+
write(bytes: Array<number>): number;
|
|
547
|
+
getCurrentPosition(): number;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
export type eTokenSeparatorSpace = 0;
|
|
551
|
+
export type eTokenSeparatorEndLine = 1;
|
|
552
|
+
export type eTokenSepratorNone = 2;
|
|
553
|
+
|
|
554
|
+
enum ETokenSeparator {
|
|
555
|
+
eTokenSeparatorSpace,
|
|
556
|
+
eTokenSeparatorEndLine,
|
|
557
|
+
eTokenSepratorNone
|
|
554
558
|
}
|
|
555
559
|
|
|
556
560
|
export interface ObjectsContext {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
*/
|
|
561
|
+
allocateNewObjectID(): FormXObjectId;
|
|
562
|
+
startDictionary(): DictionaryContext;
|
|
563
|
+
startArray(): this;
|
|
564
|
+
writeNumber(value: number): this;
|
|
565
|
+
endArray(endType?: ETokenSeparator): this;
|
|
566
|
+
endLine(): this;
|
|
567
|
+
endDictionary(dictionary: DictionaryContext): this;
|
|
568
|
+
endIndirectObject(): this;
|
|
569
|
+
writeIndirectObjectReference(objectId: FormXObjectId, generationNumber?: number): this;
|
|
570
|
+
startNewIndirectObject(objectId: FormXObjectId): this;
|
|
571
|
+
startNewIndirectObject(): FormXObjectId;
|
|
572
|
+
startModifiedIndirectObject(objectId: FormXObjectId): this;
|
|
573
|
+
deleteObject(objectId: FormXObjectId): this;
|
|
574
|
+
writeName(name: string): this;
|
|
575
|
+
writeLiteralString(literal: string | number[]): this;
|
|
576
|
+
writeHexString(hex: string | number[]): this;
|
|
577
|
+
writeBoolean(bool: boolean): this;
|
|
578
|
+
writeKeyword(keyword: string): this;
|
|
579
|
+
writeComment(comment: string): this;
|
|
580
|
+
setCompressStreams(compress: true): this;
|
|
581
|
+
startPDFStream(dictionaryContext: DictionaryContext): PDFStream;
|
|
582
|
+
startUnfilteredPDFStream(stream: DictionaryContext): PDFStream;
|
|
583
|
+
endPDFStream(stream: PDFStream): this;
|
|
584
|
+
startFreeContext(): ByteWriterWithPosition;
|
|
585
|
+
endFreeContext(): this;
|
|
583
586
|
}
|
|
584
587
|
|
|
585
588
|
export interface PDFObject {
|
|
@@ -601,30 +604,22 @@ SET_PROTOTYPE_METHOD(t, "allocateNewObjectID", AllocateNewObjectID);
|
|
|
601
604
|
}
|
|
602
605
|
|
|
603
606
|
export interface PDFReal extends PDFObject {
|
|
604
|
-
|
|
605
|
-
SET_ACCESSOR_METHOD(t, "value", GetValue);
|
|
606
|
-
*/
|
|
607
|
+
value: number;
|
|
607
608
|
}
|
|
608
609
|
|
|
609
610
|
export interface PDFSymbol extends PDFObject {
|
|
610
|
-
|
|
611
|
-
SET_ACCESSOR_METHOD(t, "value", GetValue);
|
|
612
|
-
*/
|
|
611
|
+
value: string;
|
|
613
612
|
}
|
|
614
613
|
|
|
615
614
|
export interface PDFStreamInput extends PDFObject {
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
SET_PROTOTYPE_METHOD(t, "getStreamContentStart", GetStreamContentStart);
|
|
619
|
-
*/
|
|
615
|
+
getDictionary(): PDFDictionary;
|
|
616
|
+
getStreamContentStart(): number;
|
|
620
617
|
}
|
|
621
618
|
|
|
622
619
|
export interface PDFTextString {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
SET_PROTOTYPE_METHOD(t, "fromString", FromString);
|
|
627
|
-
*/
|
|
620
|
+
toBytesArray(): Array<number>;
|
|
621
|
+
toString(): string;
|
|
622
|
+
fromString(value: string): void;
|
|
628
623
|
}
|
|
629
624
|
|
|
630
625
|
export interface PageContentContext extends AbstractContentContext {
|
|
@@ -632,56 +627,78 @@ SET_PROTOTYPE_METHOD(t, "allocateNewObjectID", AllocateNewObjectID);
|
|
|
632
627
|
getAssociatedPage(): PDFPage;
|
|
633
628
|
}
|
|
634
629
|
|
|
630
|
+
export interface JPEGInformation {
|
|
631
|
+
samplesWidth: number;
|
|
632
|
+
samplesHeight: number;
|
|
633
|
+
colorComponentsCount: number;
|
|
634
|
+
JFIFInformationExists: boolean;
|
|
635
|
+
JFIFUnit?: number;
|
|
636
|
+
JFIFXDensity?: number;
|
|
637
|
+
JFIFYDensity?: number;
|
|
638
|
+
ExifInformationExists: boolean;
|
|
639
|
+
ExifUnit?: number;
|
|
640
|
+
ExifXDensity?: number;
|
|
641
|
+
ExifYDensity?: number;
|
|
642
|
+
PhotoshopInformationExists: boolean;
|
|
643
|
+
PhotoshopXDensity?: number;
|
|
644
|
+
PhotoshopYDensity?: number;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
export type PDFRectangle = [lowerLeftX: number, lowerLeftY: number, upperRightX: number, upperRightY: number];
|
|
648
|
+
|
|
649
|
+
export interface MergeOptions {
|
|
650
|
+
password?: string;
|
|
651
|
+
type?: eRangeType;
|
|
652
|
+
specificRanges?: [[number, number]];
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
export type inInterPagesCallback = () => {}
|
|
656
|
+
|
|
657
|
+
|
|
635
658
|
export interface PDFWriter {
|
|
636
659
|
end(): PDFWriter;
|
|
637
|
-
createPage(x:
|
|
660
|
+
createPage(x: PosX, y: PosY, width: Width, height: Height): PDFPage;
|
|
638
661
|
createPage(): PDFPage;
|
|
639
662
|
writePage(page: PDFPage): this;
|
|
640
663
|
writePageAndReturnID(page: PDFPage): number;
|
|
641
664
|
startPageContentContext(page: PDFPage): PageContentContext;
|
|
642
665
|
pausePageContentContext(pageContextContext: PageContentContext): this;
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
createFormXObjectFromJPG();
|
|
647
|
-
*/
|
|
648
|
-
// TODO: test streamas
|
|
649
|
-
createFormXObjectFromPNG(filePath: FilePath | PDFRStreamForFile): FormXObject;
|
|
650
|
-
|
|
666
|
+
createFormXObject(x: PosX, y: PosY, width: Width, height: Height, objectId?: FormXObjectId): FormXObject;
|
|
667
|
+
endFormXObject(formXObject: FormXObject): this;
|
|
668
|
+
createFormXObjectFromJPG(file: FilePath | PDFRStreamForFile, objectId?: FormXObjectId): FormXObject;
|
|
651
669
|
getFontForFile(inFontFilePath: FilePath, index?: number): UsedFont;
|
|
652
670
|
getFontForFile(
|
|
653
671
|
inFontFilePath: FilePath,
|
|
654
672
|
inOptionalMetricsFile?: string,
|
|
655
673
|
index?: number,
|
|
656
674
|
): UsedFont;
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
retrieveJPGImageInformation();
|
|
663
|
-
getObjectsContext();
|
|
664
|
-
getDocumentContext();
|
|
665
|
-
*/
|
|
675
|
+
attachURLLinktoCurrentPage(url: string, x: PosX, y: PosY, width: Width, height: Height): this;
|
|
676
|
+
shutdown(outputFilePath: FilePath): this;
|
|
677
|
+
createFormXObjectFromTIFF(filePath: FilePath | PDFRStreamForFile, objectId?: FormXObjectId): FormXObject;
|
|
678
|
+
createImageXObjectFromJPG(filePath: FilePath | PDFRStreamForFile, objectId?: FormXObjectId): ImageXObject;
|
|
679
|
+
createFormXObjectFromPNG(filePath: FilePath | PDFRStreamForFile, objectId?: FormXObjectId): FormXObject;
|
|
680
|
+
retrieveJPGImageInformation(filePath: FilePath): JPEGInformation;
|
|
681
|
+
getObjectsContext(): ObjectsContext;
|
|
682
|
+
getDocumentContext(): DocumentContext;
|
|
666
683
|
appendPDFPagesFromPDF(source: FilePath | ReadStream): number[];
|
|
667
|
-
|
|
668
|
-
mergePDFPagesToPage();
|
|
669
|
-
*/
|
|
684
|
+
mergePDFPagesToPage(page: PDFPage, file: FilePath | PDFRStreamForFile, options?: MergeOptions, callback?: inInterPagesCallback): this;
|
|
685
|
+
mergePDFPagesToPage(page: PDFPage, file: FilePath | PDFRStreamForFile, callback?: inInterPagesCallback) : this;
|
|
670
686
|
createPDFCopyingContext(source: FilePath | ReadStream): DocumentCopyingContext;
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
createPDFDate();
|
|
676
|
-
*/
|
|
687
|
+
createFormXObjectsFromPDF(file: FilePath, box?: PDFBox | PDFPageBoxType, options?: MergeOptions, transformation?: TransformationMatrix, objectIds?: FormXObjectId[]): FormXObjectId[];
|
|
688
|
+
createPDFCopyingContextForModifiedFile(): DocumentCopyingContext;
|
|
689
|
+
createPDFTextString(): PDFTextString;
|
|
690
|
+
createPDFDate(): PDFDate;
|
|
677
691
|
getImageDimensions(inFontFilePath: FilePath | ReadStream): RectangleDimension;
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
692
|
+
getImagePagesCount(imagePath: FilePath, options?: {password?: string}): number;
|
|
693
|
+
getImageType(imagePath: FilePath): PDFImageType | undefined;
|
|
694
|
+
getModifiedFileParser(): PDFReader;
|
|
695
|
+
getModifiedInputFile(): InputFile;
|
|
696
|
+
getOutputFile(): OutputFile;
|
|
697
|
+
registerAnnotationReferenceForNextPageWrite(annotationId: number): this;
|
|
698
|
+
requireCatalogUpdate(): void;
|
|
699
|
+
|
|
700
|
+
/* Js Extensions (in muhammara.js) */
|
|
701
|
+
getEvents(): EventEmitter;
|
|
702
|
+
triggerDocumentExtensionEvent(eventName: string | symbol, eventParams: any): void;
|
|
686
703
|
}
|
|
687
704
|
}
|