forked from ffalt/pdf.js-extract
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
69 lines (64 loc) · 1.99 KB
/
index.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
export class PDFExtract {
extract(filename: string, options: PDFExtractOptions, callback: (err: Error | null, pdf?: PDFExtractResult) => void): void;
extract(filename: string, options: PDFExtractOptions): Promise<PDFExtractResult>;
extractBuffer(buffer: Buffer, options: PDFExtractOptions, callback: (err: Error | null, pdf?: PDFExtractResult) => void): void;
extractBuffer(buffer: Buffer, options: PDFExtractOptions): Promise<PDFExtractResult>;
}
export interface PDFExtractOptions {
firstPage?: number; // start extract at page nr, The default value is `1`
lastPage?: number; // stop extract at page nr, no default value
password?: string; // for decrypting password-protected PDFs., no default value
verbosity?: number; // log level of pdf.js, default value is `-1`
normalizeWhitespace?: boolean; //replaces all occurrences of whitespace with standard spaces (0x20). The default value is `false`.
disableCombineTextItems?: boolean; // do not attempt to combine same line {@link TextItem}'s. The default value is `false`.
}
export interface PDFExtractResult {
filename?: string;
meta?: {
info?: {
PDFFormatVersion?: string;
IsAcroFormPresent?: boolean,
IsCollectionPresent?: boolean,
IsLinearized?: boolean,
IsXFAPresent?: boolean,
Title?: string;
Author?: string;
Creator?: string;
Producer?: string;
CreationDate?: string;
ModDate?: string;
},
metadata?: {
_metadata: {
[name: string]: string;
}
}
};
pages: Array<PDFExtractPage>;
pdfInfo: {
numPages: number;
fingerprint: string;
}
}
export interface PDFExtractPage {
pageInfo: {
num: number;
scale: number;
rotation: number;
offsetX: number;
offsetY: number;
width: number;
height: number;
};
links: Array<string>;
content: Array<PDFExtractText>;
}
export interface PDFExtractText {
x: number;
y: number;
str: string;
dir: string;
width: number;
height: number;
fontName: string;
}