forked from galkahana/HummusJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hummus.d.ts
executable file
·681 lines (610 loc) · 21.6 KB
/
hummus.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
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
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
declare module 'hummus' {
export type PosX = number;
export type PosY = number;
export type Width = number;
export type Height = number;
export type FilePath = string;
export let PDFPageModifier: PDFPageModifier;
export let PDFWStreamForFile: PDFWStreamForFile;
export let PDFRStreamForFile: PDFRStreamForFile;
export let PDFRStreamForBuffer: PDFRStreamForBuffer;
export let PDFStreamForResponse: PDFStreamForResponse;
export function createWriter(
input: FilePath | WriteStream,
options?: PDFWriterOptions,
): PDFWriter;
export function createWriterToModify(
inFile: FilePath,
options?: PDFWriterToModifyOptions,
): PDFWriter;
export function createWriterToModify(
inStream: ReadStream,
outStream: WriteStream,
options?: PDFWriterToModifyOptions,
): PDFWriter;
export function createWriterToContinue(
restartFile: string,
restartStateFile: string,
options?: PDFWriterToContinueOptions,
): PDFWriter;
export function createReader(input: FilePath | ReadStream, options?: PDFReaderOptions): PDFReader;
export function recrypt(
originalPdfPath: FilePath,
newPdfPath: FilePath,
options?: PDFRecryptOptions,
): void;
export function recrypt(
originalPdfStream: any,
newPdfStream: any,
options?: PDFRecryptOptions,
): void; // TODO stream
export interface WriteStream {
write(inBytesArray: any[]): number;
getCurrentPosition(): number;
}
export interface ReadStream {
read(inAmount: number): number[];
notEnded(): boolean;
setPosition(inPosition: number): void;
setPositionFromEnd(inPosition: number): void;
skip(inAmount: number): void;
getCurrentPosition(): number;
}
export interface PDFPageInput {
getDictionary(): PDFDictionary;
getMediaBox(): PDFBox;
getCropBox(): PDFBox;
getTrimBox(): PDFBox;
getBleedBox(): PDFBox;
getArtBox(): PDFBox;
getRotate(): number;
}
export interface PDFPageModifier {
new (
writer: PDFWriter,
pageIndex?: number,
ensureContentEncapsulation?: boolean,
): PDFPageModifier;
startContext(): this;
getContext(): XObjectContentContext;
endContext(): this;
attachURLLinktoCurrentPage(
inUrl: string,
left: number,
bottom: number,
right: number,
top: number,
): this;
writePage(): this;
}
export interface PDFRStreamForFile extends ReadStream {
new (inPath: string): PDFRStreamForFile;
close(inCallback?: () => void): void;
}
export interface PDFRStreamForBuffer extends ReadStream {
new (buffer: Buffer): PDFRStreamForBuffer;
}
export interface ColorOptions {
colorspace?: string;
color?: string | number;
}
export interface GraphicOptions extends ColorOptions {
type?: 'stroke' | 'fill' | 'clip';
width?: number;
close?: boolean;
}
export interface AbstractContentContext {
b(): this;
B(): this;
bStar(): this;
BStar(): this;
s(): this;
S(): this;
f(): this;
F(): this;
fStar(): this;
n(): this;
m(x: number, y: number): this;
l(x: number, y: number): this;
c(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): number;
v(x2: number, y2: number, x3: number, y3: number): this;
y(x1: number, y1: number, x3: number, y3: number): this;
h(): this;
re(left: number, bottom: number, width: number, height: number): this;
q(): this;
Q(): this;
/**
* a b 0
* c d 0
* e f 1
*/
cm(a: number, b: number, c: number, d: number, e: number, f: number): this;
w(lineWidth: number): this;
J(lineCapStyle: number): this;
j(lineJoinStyle: number): this;
M(miterLimit: number): this;
d(miterLimit: number[], dashPhase: number): this;
ri(renderingIntentName: string): this;
i(flatness: number): this;
gs(graphicStateName: string): this;
CS(colorSpaceName: string): this;
cs(colorSpaceName: string): this;
SC(...colorComponents: number[]): this;
SCN(...parameters: any[]): this; // This can't be materialized in TypeScript
////SCN(...colorComponents: number[], patternName?: string): this;
sc(...colorComponents: number[]): this;
scn(...parameters: any[]): this; // This can't be materialized in TypeScript
////scn(...colorComponents: number[], patternName?: string): this;
G(gray: number): this;
g(gray: number): this;
RG(r: number, g: number, b: number): this;
rg(r: number, g: number, b: number): this;
K(c: number, m: number, y: number, k: number): this;
k(c: number, m: number, y: number, k: number): this;
W(): this;
WStar(): this;
doXObject(xObject: string | any): this; // TODO
Tc(characterSpace: number): this;
Tw(wordSpace: number): this;
Tz(horizontalScaling: number): this;
TL(textLeading: number): this;
Tr(renderingMode: number): this;
Ts(fontRise: number): this;
BT(): this;
ET(): this;
Td(tX: number, tY: number): this;
TD(tX: number, tY: number): this;
Tm(a: number, b: number, c: number, d: number, e: number, f: number): this;
TStar(): this;
Tf(fontReferenced: UsedFont | string, fontSize: number): this;
Tj(text: string | any): this; // Glyph
Quote(text: string | any): this; // Glyph
DoubleQuote(wordSpacing: number, characterString: number, text: string | any): this; // Glyph
TJ(stringsAndSpacing: any): this; // TODO
writeFreeCode(freeCode: string): this;
drawPath(...parameters: any[]): this; // This can't be materialized in TypeScript
////drawPath(...xyPairs: number[], options: GraphicOptions): this;
drawCircle(x: number, y: number, r: number, options: GraphicOptions): this;
drawSquare(x: number, y: number, l: number, options: GraphicOptions): this;
drawRectangle(x: number, y: number, w: number, h: number, options: GraphicOptions): this;
writeText(text: string, x: number, y: number, options?: WriteTextOptions): this;
drawImage(x: number, y: number, imagePath: string, options?: ImageOptions): this;
}
export interface TransformationObject {
width: number;
height: number;
proportional?: boolean;
fit?: 'always' | 'overflow';
}
export interface ImageOptions {
index?: number;
transformation?: number[] | TransformationObject;
password?: string;
}
export interface FontOptions {
size?: number;
font?: UsedFont;
}
export interface WriteTextOptions extends FontOptions, ColorOptions {
underline?: boolean;
}
export interface XObjectContentContext extends AbstractContentContext {}
export interface PDFWStreamForFile extends WriteStream {
new (inPath: string): PDFWStreamForFile;
close(inCallback?: () => void): void;
}
export interface PDFStreamForResponse extends WriteStream {
new (res: any): PDFStreamForResponse;
}
export interface PDFReaderOptions {
password: string;
}
export interface PDFWriterToModifyOptions extends PDFWriterOptions {
modifiedFilePath?: string;
}
export interface PDFWriterToContinueOptions {
modifiedFilePath?: string;
alternativeStream?: any; // TODO
log?: string;
}
export interface PDFRecryptOptions extends PDFWriterOptions {
password?: string;
}
export const ePDFVersion10 = 10;
export const ePDFVersion11 = 11;
export const ePDFVersion12 = 12;
export const ePDFVersion13 = 13;
export const ePDFVersion14 = 14;
export const ePDFVersion15 = 15;
export const ePDFVersion16 = 16;
export const ePDFVersion17 = 17;
export type EPDFVersion = 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17;
export const ePDFObjectBoolean = 0;
export const ePDFObjectLiteralString = 1;
export const ePDFObjectHexString = 2;
export const ePDFObjectNull = 3;
export const ePDFObjectName = 4;
export const ePDFObjectInteger = 5;
export const ePDFObjectReal = 6;
export const ePDFObjectArray = 7;
export const ePDFObjectDictionary = 8;
export const ePDFObjectIndirectObjectReference = 9;
export const ePDFObjectStream = 10;
export const ePDFObjectSymbol = 11;
export type PDFObjectType = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
export const ePDFPageBoxMediaBox = 0;
export const ePDFPageBoxCropBox = 1;
export const ePDFPageBoxBleedBox = 2;
export const ePDFPageBoxTrimBox = 3;
export const ePDFPageBoxArtBox = 4;
export type PDFPageBoxType = 0 | 1 | 2 | 3 | 4;
export interface PDFWriterOptions {
version?: EPDFVersion;
log?: string;
compress?: boolean;
userPassword?: string;
ownerPassword?: string;
userProtectionFlag?: number;
}
type FormXObjectId = number;
export interface FormXObject {
id: FormXObjectId;
}
export interface ResourcesDictionary {
addFormXObjectMapping(formXObject: FormXObject): any;
/*
SET_PROTOTYPE_METHOD(t, "addImageXObjectMapping", AddImageXObjectMapping);
SET_PROTOTYPE_METHOD(t, "addProcsetResource", AddProcsetResource);
SET_PROTOTYPE_METHOD(t, "addExtGStateMapping", AddExtGStateMapping);
SET_PROTOTYPE_METHOD(t, "addFontMapping", AddFontMapping);
SET_PROTOTYPE_METHOD(t, "addColorSpaceMapping", AddColorSpaceMapping);
SET_PROTOTYPE_METHOD(t, "addPatternMapping", AddPatternMapping);
SET_PROTOTYPE_METHOD(t, "addPropertyMapping", AddPropertyMapping);
SET_PROTOTYPE_METHOD(t, "addXObjectMapping", AddXObjectMapping);
SET_PROTOTYPE_METHOD(t, "addShadingMapping", AddShadingMapping);
*/
}
export type PDFBox = [PosX, PosY, Width, Height];
export interface PDFPage {
mediaBox?: PDFBox;
cropBox?: PDFBox;
bleedBox?: PDFBox;
trimBox?: PDFBox;
artBox?: PDFBox;
rotate?: number;
getResourcesDictionary(): ResourcesDictionary;
/*
SET_ACCESSOR_METHODS(t, "mediaBox", GetMediaBox, SetMediaBox);
SET_ACCESSOR_METHODS(t, "cropBox", GetCropBox, SetCropBox);
SET_ACCESSOR_METHODS(t, "bleedBox", GetBleedBox, SetBleedBox);
SET_ACCESSOR_METHODS(t, "trimBox", GetTrimBox, SetTrimBox);
SET_ACCESSOR_METHODS(t, "artBox", GetArtBox, SetArtBox);
SET_ACCESSOR_METHODS(t, "rotate",GetRotate, SetRotate);
SET_PROTOTYPE_METHOD(t, "getResourcesDictionary", GetResourcesDictionary);
*/
}
export interface TextDimension {
xMin: number;
yMin: number;
xMax: number;
yMax: number;
width: number;
height: number;
}
export interface RectangleDimension {
width: Width;
height: Height;
}
export interface UsedFont {
calculateTextDimensions(text: string | any, fontSize: number): TextDimension;
}
export interface ByteWriter {
write(buffer: number[]): number;
}
export interface ByteReader {
/*
SET_PROTOTYPE_METHOD(t, "read", Read);
SET_PROTOTYPE_METHOD(t, "notEnded", NotEnded);
*/
}
export interface ByteReaderWithPosition {
/*
SET_PROTOTYPE_METHOD(t, "read", Read);
SET_PROTOTYPE_METHOD(t, "notEnded", NotEnded);
SET_PROTOTYPE_METHOD(t, "setPosition", SetPosition);
SET_PROTOTYPE_METHOD(t, "getCurrentPosition", GetCurrentPosition);
SET_PROTOTYPE_METHOD(t, "setPositionFromEnd", SetPositionFromEnd);
SET_PROTOTYPE_METHOD(t, "skip", Skip);
*/
}
export interface PDFReader {
getPDFLevel(): number;
getPagesCount(): number;
getTrailer(): PDFDictionary;
queryDictionaryObject(dictionary: PDFDictionary, name: string): PDFObject;
/*
SET_PROTOTYPE_METHOD(t, "queryArrayObject", QueryArrayObject);
*/
parseNewObject(objectId: number): PDFObject;
/*
SET_PROTOTYPE_METHOD(t, "getPageObjectID", GetPageObjectID);
SET_PROTOTYPE_METHOD(t, "parsePageDictionary", ParsePageDictionary);
*/
parsePage(page: number): PDFPageInput;
/*
SET_PROTOTYPE_METHOD(t, "getObjectsCount", GetObjectsCount);
SET_PROTOTYPE_METHOD(t, "isEncrypted", IsEncrypted);
SET_PROTOTYPE_METHOD(t, "getXrefSize", GetXrefSize);
SET_PROTOTYPE_METHOD(t, "getXrefEntry", GetXrefEntry);
SET_PROTOTYPE_METHOD(t, "getXrefPosition", GetXrefPosition);
SET_PROTOTYPE_METHOD(t, "startReadingFromStream", StartReadingFromStream);
SET_PROTOTYPE_METHOD(t, "getParserStream", GetParserStream);
*/
}
export interface PDFStream {
getWriteStream(): ByteWriter;
}
export interface PDFNull extends PDFObject {
/*
SET_ACCESSOR_METHOD(t, "value", GetValue);
*/
}
export interface PDFName extends PDFObject {
/*
SET_ACCESSOR_METHOD(t, "value", GetValue);
*/
}
export interface PDFLiteralString extends PDFObject {
toText(): string;
value: string;
}
export interface PDFInteger extends PDFObject {
/*
SET_ACCESSOR_METHOD(t, "value", GetValue);
*/
}
export interface PDFIndirectObjectReference extends PDFObject {
getObjectID(): number;
getVersion(): number;
}
export interface PDFHexString extends PDFObject {
/*
SET_ACCESSOR_METHOD(t, "value", GetValue);
*/
}
export interface PDFDictionary extends PDFObject {
toJSObject(): object;
exists(inName: string): boolean;
queryObject(inName: string): PDFObject;
}
export interface PDFDate {
/*
SET_PROTOTYPE_METHOD(t, "toString", ToString);
SET_PROTOTYPE_METHOD(t, "setToCurrentTime", SetToCurrentTime);
*/
}
export interface PDFBoolean extends PDFObject {
/*
SET_ACCESSOR_METHOD(t, "value", GetValue);
*/
}
export interface PDFArray extends PDFObject {
/*
SET_PROTOTYPE_METHOD(t, "toJSArray", ToJSArray);
SET_PROTOTYPE_METHOD(t, "queryObject", QueryObject);
SET_PROTOTYPE_METHOD(t, "getLength", GetLength);
*/
}
export interface OutputFile {
/*
SET_PROTOTYPE_METHOD(t, "openFile", OpenFile);
SET_PROTOTYPE_METHOD(t, "closeFile", CloseFile);
SET_PROTOTYPE_METHOD(t, "getFilePath", GetFilePath);
SET_PROTOTYPE_METHOD(t, "getOutputStream", GetOutputStream);
*/
}
export interface InputFile {
/*
SET_PROTOTYPE_METHOD(t, "openFile", OpenFile);
SET_PROTOTYPE_METHOD(t, "closeFile", CloseFile);
SET_PROTOTYPE_METHOD(t, "getFilePath", GetFilePath);
SET_PROTOTYPE_METHOD(t, "getFileSize", GetFileSize);
SET_PROTOTYPE_METHOD(t, "getInputStream", GetInputStream);
*/
}
export interface InfoDictionary {
/*
SET_PROTOTYPE_METHOD(t, "addAdditionalInfoEntry", AddAdditionalInfoEntry);
SET_PROTOTYPE_METHOD(t, "removeAdditionalInfoEntry", RemoveAdditionalInfoEntry);
SET_PROTOTYPE_METHOD(t, "clearAdditionalInfoEntries", ClearAdditionalInfoEntries);
SET_PROTOTYPE_METHOD(t, "getAdditionalInfoEntry", GetAdditionalInfoEntry);
SET_PROTOTYPE_METHOD(t, "getAdditionalInfoEntries", GetAdditionalInfoEntries);
SET_PROTOTYPE_METHOD(t, "setCreationDate", SetCreationDate);
SET_PROTOTYPE_METHOD(t, "setModDate", SetModDate);
SET_ACCESSOR_METHODS(t, "title", GetTitle, SetTitle);
SET_ACCESSOR_METHODS(t, "author", GetAuthor, SetAuthor);
SET_ACCESSOR_METHODS(t, "subject", GetSubject, SetSubject);
SET_ACCESSOR_METHODS(t, "keywords", GetKeywords, SetKeywords);
SET_ACCESSOR_METHODS(t, "creator", GetCreator, SetCreator);
SET_ACCESSOR_METHODS(t, "producer", GetProducer, SetProducer);
SET_ACCESSOR_METHODS(t, "trapped", GetTrapped, SetTrapped);
*/
}
export interface ImageXObject {
/*
SET_ACCESSOR_METHOD(t, "id", GetID);
*/
}
export interface FormObject {
/*
SET_ACCESSOR_METHOD(t,"id", GetID);
SET_PROTOTYPE_METHOD(t, "getContentContext", GetContentContext);
SET_PROTOTYPE_METHOD(t, "getResourcesDictinary", GetResourcesDictionary);
SET_PROTOTYPE_METHOD(t, "getContentStream", GetContentStream);
*/
}
export interface DocumentCopyingContext {
createFormXObjectFromPDFPage(
sourcePageIndex: number,
ePDFPageBox: PDFPageBoxType | PDFBox,
): number;
mergePDFPageToPage(target: PDFPage, sourcePageIndex: number): void;
appendPDFPageFromPDF(sourcePageNumber: number): number; // stream start bytes?
mergePDFPageToFormXObject(sourcePage: PDFPage, targetPageNumber: number): any;
/*
SET_PROTOTYPE_METHOD(t, "getSourceDocumentParser", GetSourceDocumentParser);
SET_PROTOTYPE_METHOD(t, "copyDirectObjectAsIs", CopyDirectObjectAsIs);
SET_PROTOTYPE_METHOD(t, "copyObject", CopyObject);
SET_PROTOTYPE_METHOD(t, "copyDirectObjectWithDeepCopy", CopyDirectObjectWithDeepCopy);
SET_PROTOTYPE_METHOD(t, "copyNewObjectsForDirectObject", CopyNewObjectsForDirectObject);
SET_PROTOTYPE_METHOD(t, "getCopiedObjectID", GetCopiedObjectID);
SET_PROTOTYPE_METHOD(t, "getCopiedObjects", GetCopiedObjects);
SET_PROTOTYPE_METHOD(t, "replaceSourceObjects", ReplaceSourceObjects);
SET_PROTOTYPE_METHOD(t, "getSourceDocumentStream", GetSourceDocumentStream);
*/
}
export interface DocumentContext {
/*
SET_PROTOTYPE_METHOD(t, "getInfoDictionary", GetInfoDictionary);
*/
}
export interface DictionaryContext {
/*
SET_PROTOTYPE_METHOD(t, "writeKey", WriteKey);
SET_PROTOTYPE_METHOD(t, "writeNameValue", WriteNameValue);
SET_PROTOTYPE_METHOD(t, "writeRectangleValue", WriteRectangleValue);
SET_PROTOTYPE_METHOD(t, "writeLiteralStringValue", WriteLiteralStringValue);
SET_PROTOTYPE_METHOD(t, "writeBooleanValue", WriteBooleanValue);
SET_PROTOTYPE_METHOD(t, "writeObjectReferenceValue", WriteObjectReferenceValue);
*/
}
export interface ByteWriterWithPosition {
/*
SET_PROTOTYPE_METHOD(t, "write", Write);
SET_PROTOTYPE_METHOD(t, "getCurrentPosition", GetCurrentPosition);
*/
}
export interface ObjectsContext {
/*
SET_PROTOTYPE_METHOD(t, "allocateNewObjectID", AllocateNewObjectID);
SET_PROTOTYPE_METHOD(t, "startDictionary", StartDictionary);
SET_PROTOTYPE_METHOD(t, "startArray", StartArray);
SET_PROTOTYPE_METHOD(t, "writeNumber", WriteNumber);
SET_PROTOTYPE_METHOD(t, "endArray", EndArray);
SET_PROTOTYPE_METHOD(t, "endLine", EndLine);
SET_PROTOTYPE_METHOD(t, "endDictionary", EndDictionary);
SET_PROTOTYPE_METHOD(t, "endIndirectObject", EndIndirectObject);
SET_PROTOTYPE_METHOD(t, "writeIndirectObjectReference", WriteIndirectObjectReference);
SET_PROTOTYPE_METHOD(t, "startNewIndirectObject", StartNewIndirectObject);
SET_PROTOTYPE_METHOD(t, "startModifiedIndirectObject", StartModifiedIndirectObject);
SET_PROTOTYPE_METHOD(t, "deleteObject", DeleteObject);
SET_PROTOTYPE_METHOD(t, "writeName", WriteName);
SET_PROTOTYPE_METHOD(t, "writeLiteralString", WriteLiteralString);
SET_PROTOTYPE_METHOD(t, "writeHexString", WriteHexString);
SET_PROTOTYPE_METHOD(t, "writeBoolean", WriteBoolean);
SET_PROTOTYPE_METHOD(t, "writeKeyword", WriteKeyword);
SET_PROTOTYPE_METHOD(t, "writeComment", WriteComment);
SET_PROTOTYPE_METHOD(t, "setCompressStreams", SetCompressStreams);
SET_PROTOTYPE_METHOD(t, "startPDFStream", StartPDFStream);
SET_PROTOTYPE_METHOD(t, "startUnfilteredPDFStream", StartUnfilteredPDFStream);
SET_PROTOTYPE_METHOD(t, "endPDFStream", EndPDFStream);
SET_PROTOTYPE_METHOD(t, "startFreeContext", StartFreeContext);
SET_PROTOTYPE_METHOD(t, "endFreeContext", EndFreeContext);
*/
}
export interface PDFObject {
getType(): PDFObjectType;
toPDFIndirectObjectReference(): PDFIndirectObjectReference;
toPDFArray(): PDFArray;
toPDFDictionary(): PDFDictionary;
toPDFStream(): PDFStream;
toPDFBoolean(): PDFBoolean;
toPDFLiteralString(): PDFLiteralString;
toPDFHexString(): PDFHexString;
toPDFNull(): PDFNull;
toPDFName(): PDFName;
toPDFInteger(): PDFInteger;
toPDFReal(): PDFReal;
toPDFSymbol(): PDFSymbol;
toNumber(): number;
toString(): string;
}
export interface PDFReal extends PDFObject {
/*
SET_ACCESSOR_METHOD(t, "value", GetValue);
*/
}
export interface PDFSymbol extends PDFObject {
/*
SET_ACCESSOR_METHOD(t, "value", GetValue);
*/
}
export interface PDFStreamInput extends PDFObject {
/*
SET_PROTOTYPE_METHOD(t, "getDictionary", GetDictionary);
SET_PROTOTYPE_METHOD(t, "getStreamContentStart", GetStreamContentStart);
*/
}
export interface PDFTextString {
/*
SET_PROTOTYPE_METHOD(t, "toBytesArray", ToBytesArray);
SET_PROTOTYPE_METHOD(t, "toString", ToString);
SET_PROTOTYPE_METHOD(t, "fromString", FromString);
*/
}
export interface PageContentContext extends AbstractContentContext {
getCurrentPageContentStream(): PDFStream;
getAssociatedPage(): PDFPage;
}
export interface PDFWriter {
end(): PDFWriter;
createPage(x: number, y: number, width: number, height: number): PDFPage;
createPage(): PDFPage;
writePage(page: PDFPage): this;
writePageAndReturnID(page: PDFPage): number;
startPageContentContext(page: PDFPage): PageContentContext;
pausePageContentContext(pageContextContext: PageContentContext): this;
/*
createFormXObject();
endFormXObject();
createFormXObjectFromJPG();
*/
// TODO: test streamas
createFormXObjectFromPNG(filePath: FilePath | PDFRStreamForFile): FormXObject;
getFontForFile(inFontFilePath: FilePath, index?: number): UsedFont;
getFontForFile(
inFontFilePath: FilePath,
inOptionalMetricsFile?: string,
index?: number,
): UsedFont;
/*
attachURLLinktoCurrentPage();
shutdown();
createFormXObjectFromTIFF();
createImageXObjectFromJPG();
retrieveJPGImageInformation();
getObjectsContext();
getDocumentContext();
*/
appendPDFPagesFromPDF(source: FilePath | ReadStream): number[];
/*
mergePDFPagesToPage();
*/
createPDFCopyingContext(source: FilePath | ReadStream): DocumentCopyingContext;
/*
createFormXObjectsFromPDF();
createPDFCopyingContextForModifiedFile();
createPDFTextString();
createPDFDate();
*/
getImageDimensions(inFontFilePath: FilePath | ReadStream): RectangleDimension;
/*
getImagePagesCount();
getImageType();
getModifiedFileParser();
getModifiedInputFile();
getOutputFile();
registerAnnotationReferenceForNextPageWrite();
*/
}
}