@f-o-t/pdf 0.1.0 → 0.1.4
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/core/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/objects.d.ts +42 -0
- package/dist/core/objects.d.ts.map +1 -0
- package/dist/errors.d.ts +58 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/index-4jtcmpfh.js +48 -0
- package/dist/index-4jtcmpfh.js.map +10 -0
- package/dist/index-jsfksnj3.js +503 -0
- package/dist/index-jsfksnj3.js.map +14 -0
- package/dist/index-kjz7by1m.js +572 -0
- package/dist/index-kjz7by1m.js.map +13 -0
- package/dist/index.d.ts +7 -808
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -5
- package/dist/index.js.map +9 -0
- package/dist/plugins/generation/document.d.ts +38 -0
- package/dist/plugins/generation/document.d.ts.map +1 -0
- package/dist/plugins/generation/fonts.d.ts +59 -0
- package/dist/plugins/generation/fonts.d.ts.map +1 -0
- package/dist/plugins/generation/index.d.ts +5 -0
- package/dist/plugins/generation/index.d.ts.map +1 -0
- package/dist/plugins/generation/index.js +26 -0
- package/dist/plugins/generation/index.js.map +9 -0
- package/dist/plugins/generation/page.d.ts +56 -0
- package/dist/plugins/generation/page.d.ts.map +1 -0
- package/dist/plugins/generation/writer.d.ts +14 -0
- package/dist/plugins/generation/writer.d.ts.map +1 -0
- package/dist/plugins/parsing/index.d.ts +4 -0
- package/dist/plugins/parsing/index.d.ts.map +1 -0
- package/dist/plugins/parsing/index.js +16 -0
- package/dist/plugins/parsing/index.js.map +9 -0
- package/dist/plugins/parsing/lexer.d.ts +76 -0
- package/dist/plugins/parsing/lexer.d.ts.map +1 -0
- package/dist/plugins/parsing/parser.d.ts +63 -0
- package/dist/plugins/parsing/parser.d.ts.map +1 -0
- package/dist/plugins/parsing/reader.d.ts +66 -0
- package/dist/plugins/parsing/reader.d.ts.map +1 -0
- package/dist/schemas.d.ts +233 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/types.d.ts +123 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +27 -70
- package/dist/generation/index.d.ts +0 -268
- package/dist/generation/index.js +0 -26
- package/dist/parsing/index.d.ts +0 -234
- package/dist/parsing/index.js +0 -16
- package/dist/shared/chunk-10ftnz45.js +0 -572
- package/dist/shared/chunk-37mjkw9w.js +0 -492
- package/dist/shared/chunk-6dengthp.js +0 -48
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PDF reference to indirect object
|
|
3
|
-
*/
|
|
4
|
-
type PDFRef = {
|
|
5
|
-
readonly objectNumber: number;
|
|
6
|
-
readonly generation: number;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* PDF value types
|
|
10
|
-
*/
|
|
11
|
-
type PDFValue = boolean | number | string | PDFName | PDFArray | PDFDictionary | PDFStream | null | PDFRef;
|
|
12
|
-
/**
|
|
13
|
-
* PDF Name object
|
|
14
|
-
*/
|
|
15
|
-
type PDFName = {
|
|
16
|
-
readonly type: "name";
|
|
17
|
-
readonly value: string;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* PDF Array
|
|
21
|
-
*/
|
|
22
|
-
type PDFArray = PDFValue[];
|
|
23
|
-
/**
|
|
24
|
-
* PDF Dictionary
|
|
25
|
-
*/
|
|
26
|
-
type PDFDictionary = Record<string, PDFValue>;
|
|
27
|
-
/**
|
|
28
|
-
* PDF Stream
|
|
29
|
-
*/
|
|
30
|
-
type PDFStream = {
|
|
31
|
-
readonly dictionary: PDFDictionary;
|
|
32
|
-
readonly data: Uint8Array;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* PDF Page size presets
|
|
36
|
-
*/
|
|
37
|
-
type PageSize = "A4" | "Letter" | "Legal" | "A3" | "A5" | "Tabloid" | {
|
|
38
|
-
width: number;
|
|
39
|
-
height: number;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* PDF Color
|
|
43
|
-
*/
|
|
44
|
-
type PDFColor = {
|
|
45
|
-
type: "rgb";
|
|
46
|
-
r: number;
|
|
47
|
-
g: number;
|
|
48
|
-
b: number;
|
|
49
|
-
} | {
|
|
50
|
-
type: "cmyk";
|
|
51
|
-
c: number;
|
|
52
|
-
m: number;
|
|
53
|
-
y: number;
|
|
54
|
-
k: number;
|
|
55
|
-
} | {
|
|
56
|
-
type: "gray";
|
|
57
|
-
gray: number;
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Text options
|
|
61
|
-
*/
|
|
62
|
-
type TextOptions = {
|
|
63
|
-
x: number;
|
|
64
|
-
y: number;
|
|
65
|
-
size?: number;
|
|
66
|
-
font?: string;
|
|
67
|
-
color?: PDFColor;
|
|
68
|
-
align?: "left" | "center" | "right";
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Rectangle options
|
|
72
|
-
*/
|
|
73
|
-
type RectOptions = {
|
|
74
|
-
x: number;
|
|
75
|
-
y: number;
|
|
76
|
-
width: number;
|
|
77
|
-
height: number;
|
|
78
|
-
fill?: PDFColor;
|
|
79
|
-
stroke?: PDFColor;
|
|
80
|
-
lineWidth?: number;
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* Line options
|
|
84
|
-
*/
|
|
85
|
-
type LineOptions = {
|
|
86
|
-
x1: number;
|
|
87
|
-
y1: number;
|
|
88
|
-
x2: number;
|
|
89
|
-
y2: number;
|
|
90
|
-
color?: PDFColor;
|
|
91
|
-
lineWidth?: number;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* PDF metadata
|
|
95
|
-
*/
|
|
96
|
-
type PDFMetadata = {
|
|
97
|
-
title?: string;
|
|
98
|
-
author?: string;
|
|
99
|
-
subject?: string;
|
|
100
|
-
keywords?: string[];
|
|
101
|
-
creator?: string;
|
|
102
|
-
producer?: string;
|
|
103
|
-
creationDate?: Date;
|
|
104
|
-
modificationDate?: Date;
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* PDF version
|
|
108
|
-
*/
|
|
109
|
-
type PDFVersion = "1.4" | "1.5" | "1.6" | "1.7";
|
|
110
|
-
type PDFPageOptions = {
|
|
111
|
-
size?: PageSize;
|
|
112
|
-
parent?: PDFRef;
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* PDF Page class
|
|
116
|
-
*/
|
|
117
|
-
declare class PDFPage {
|
|
118
|
-
ref: PDFRef;
|
|
119
|
-
size: PageSize;
|
|
120
|
-
parent?: PDFRef;
|
|
121
|
-
contentStream: string[];
|
|
122
|
-
private resources;
|
|
123
|
-
constructor(ref: PDFRef, options?: PDFPageOptions);
|
|
124
|
-
/**
|
|
125
|
-
* Get page dimensions in points
|
|
126
|
-
*/
|
|
127
|
-
getDimensions(): {
|
|
128
|
-
width: number;
|
|
129
|
-
height: number;
|
|
130
|
-
};
|
|
131
|
-
/**
|
|
132
|
-
* Set fill color
|
|
133
|
-
*/
|
|
134
|
-
private setFillColor;
|
|
135
|
-
/**
|
|
136
|
-
* Set stroke color
|
|
137
|
-
*/
|
|
138
|
-
private setStrokeColor;
|
|
139
|
-
/**
|
|
140
|
-
* Draw text on the page
|
|
141
|
-
*/
|
|
142
|
-
drawText(text: string, options: TextOptions): void;
|
|
143
|
-
/**
|
|
144
|
-
* Draw a rectangle
|
|
145
|
-
*/
|
|
146
|
-
drawRectangle(options: RectOptions): void;
|
|
147
|
-
/**
|
|
148
|
-
* Draw a line
|
|
149
|
-
*/
|
|
150
|
-
drawLine(options: LineOptions): void;
|
|
151
|
-
/**
|
|
152
|
-
* Get content stream reference
|
|
153
|
-
*/
|
|
154
|
-
getContentStreamRef(): PDFRef;
|
|
155
|
-
/**
|
|
156
|
-
* Generate content stream as PDFStream
|
|
157
|
-
*/
|
|
158
|
-
toContentStream(): PDFStream;
|
|
159
|
-
/**
|
|
160
|
-
* Convert page to PDF dictionary
|
|
161
|
-
*/
|
|
162
|
-
toDictionary(): PDFDictionary;
|
|
163
|
-
}
|
|
164
|
-
type PDFDocumentOptions = {
|
|
165
|
-
version?: PDFVersion;
|
|
166
|
-
metadata?: PDFMetadata;
|
|
167
|
-
};
|
|
168
|
-
/**
|
|
169
|
-
* Main PDF Document class for generation
|
|
170
|
-
*
|
|
171
|
-
* @property version - PDF version (1.4, 1.5, 1.6, or 1.7)
|
|
172
|
-
* @property metadata - Document metadata (title, author, etc.)
|
|
173
|
-
* @property catalog - Reference to the document catalog
|
|
174
|
-
* @property pages - Reference to the pages tree root
|
|
175
|
-
*/
|
|
176
|
-
declare class PDFDocument {
|
|
177
|
-
version: PDFVersion;
|
|
178
|
-
metadata: PDFMetadata;
|
|
179
|
-
private objects;
|
|
180
|
-
private nextObjectNumber;
|
|
181
|
-
catalog: PDFRef;
|
|
182
|
-
pages: PDFRef;
|
|
183
|
-
private pagesArray;
|
|
184
|
-
constructor(options?: PDFDocumentOptions);
|
|
185
|
-
/**
|
|
186
|
-
* Allocate a new object reference
|
|
187
|
-
*/
|
|
188
|
-
private allocateRef;
|
|
189
|
-
/**
|
|
190
|
-
* Add a page to the document
|
|
191
|
-
*/
|
|
192
|
-
addPage(options?: PDFPageOptions): PDFPage;
|
|
193
|
-
/**
|
|
194
|
-
* Save PDF to bytes
|
|
195
|
-
*/
|
|
196
|
-
save(): Uint8Array;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* PDF Standard 14 Fonts
|
|
200
|
-
* These fonts are guaranteed to be available in all PDF readers
|
|
201
|
-
*/
|
|
202
|
-
declare const STANDARD_FONTS: {
|
|
203
|
-
readonly "Times-Roman": "Times-Roman";
|
|
204
|
-
readonly "Times-Bold": "Times-Bold";
|
|
205
|
-
readonly "Times-Italic": "Times-Italic";
|
|
206
|
-
readonly "Times-BoldItalic": "Times-BoldItalic";
|
|
207
|
-
readonly Helvetica: "Helvetica";
|
|
208
|
-
readonly "Helvetica-Bold": "Helvetica-Bold";
|
|
209
|
-
readonly "Helvetica-Oblique": "Helvetica-Oblique";
|
|
210
|
-
readonly "Helvetica-BoldOblique": "Helvetica-BoldOblique";
|
|
211
|
-
readonly Courier: "Courier";
|
|
212
|
-
readonly "Courier-Bold": "Courier-Bold";
|
|
213
|
-
readonly "Courier-Oblique": "Courier-Oblique";
|
|
214
|
-
readonly "Courier-BoldOblique": "Courier-BoldOblique";
|
|
215
|
-
readonly Symbol: "Symbol";
|
|
216
|
-
readonly ZapfDingbats: "ZapfDingbats";
|
|
217
|
-
};
|
|
218
|
-
type StandardFont = keyof typeof STANDARD_FONTS;
|
|
219
|
-
/**
|
|
220
|
-
* Font families for convenience
|
|
221
|
-
*/
|
|
222
|
-
declare const FONT_FAMILIES: {
|
|
223
|
-
times: {
|
|
224
|
-
regular: StandardFont;
|
|
225
|
-
bold: StandardFont;
|
|
226
|
-
italic: StandardFont;
|
|
227
|
-
boldItalic: StandardFont;
|
|
228
|
-
};
|
|
229
|
-
helvetica: {
|
|
230
|
-
regular: StandardFont;
|
|
231
|
-
bold: StandardFont;
|
|
232
|
-
oblique: StandardFont;
|
|
233
|
-
boldOblique: StandardFont;
|
|
234
|
-
};
|
|
235
|
-
courier: {
|
|
236
|
-
regular: StandardFont;
|
|
237
|
-
bold: StandardFont;
|
|
238
|
-
oblique: StandardFont;
|
|
239
|
-
boldOblique: StandardFont;
|
|
240
|
-
};
|
|
241
|
-
symbol: {
|
|
242
|
-
regular: StandardFont;
|
|
243
|
-
};
|
|
244
|
-
zapfDingbats: {
|
|
245
|
-
regular: StandardFont;
|
|
246
|
-
};
|
|
247
|
-
};
|
|
248
|
-
/**
|
|
249
|
-
* Check if a font is a standard PDF font
|
|
250
|
-
*/
|
|
251
|
-
declare function isStandardFont(font: string): font is StandardFont;
|
|
252
|
-
/**
|
|
253
|
-
* Get font object reference name
|
|
254
|
-
*/
|
|
255
|
-
declare function getFontRefName(font: StandardFont): string;
|
|
256
|
-
/**
|
|
257
|
-
* Serialize a PDF value to string
|
|
258
|
-
*/
|
|
259
|
-
declare function serializeValue(value: PDFValue): string;
|
|
260
|
-
/**
|
|
261
|
-
* Serialize a PDF stream
|
|
262
|
-
*/
|
|
263
|
-
declare function serializeStream(stream: PDFStream): Uint8Array;
|
|
264
|
-
/**
|
|
265
|
-
* Serialize an indirect object
|
|
266
|
-
*/
|
|
267
|
-
declare function serializeObject(objectNumber: number, generation: number, value: any): Uint8Array;
|
|
268
|
-
export { serializeValue, serializeStream, serializeObject, isStandardFont, getFontRefName, StandardFont, STANDARD_FONTS, PDFPageOptions, PDFPage, PDFDocumentOptions, PDFDocument, FONT_FAMILIES };
|
package/dist/generation/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FONT_FAMILIES,
|
|
3
|
-
PDFDocument,
|
|
4
|
-
PDFPage,
|
|
5
|
-
STANDARD_FONTS,
|
|
6
|
-
getFontRefName,
|
|
7
|
-
isStandardFont,
|
|
8
|
-
serializeObject,
|
|
9
|
-
serializeStream,
|
|
10
|
-
serializeValue
|
|
11
|
-
} from "../shared/chunk-37mjkw9w.js";
|
|
12
|
-
import"../shared/chunk-6dengthp.js";
|
|
13
|
-
export {
|
|
14
|
-
serializeValue,
|
|
15
|
-
serializeStream,
|
|
16
|
-
serializeObject,
|
|
17
|
-
isStandardFont,
|
|
18
|
-
getFontRefName,
|
|
19
|
-
STANDARD_FONTS,
|
|
20
|
-
PDFPage,
|
|
21
|
-
PDFDocument,
|
|
22
|
-
FONT_FAMILIES
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
//# debugId=3E109D686F511FD064756E2164756E21
|
|
26
|
-
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFtdLAogICJzb3VyY2VzQ29udGVudCI6IFsKICBdLAogICJtYXBwaW5ncyI6ICIiLAogICJkZWJ1Z0lkIjogIjNFMTA5RDY4NkY1MTFGRDA2NDc1NkUyMTY0NzU2RTIxIiwKICAibmFtZXMiOiBbXQp9
|
package/dist/parsing/index.d.ts
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PDF token types
|
|
3
|
-
*/
|
|
4
|
-
declare enum TokenType {
|
|
5
|
-
NUMBER = "NUMBER",
|
|
6
|
-
STRING = "STRING",
|
|
7
|
-
NAME = "NAME",
|
|
8
|
-
BOOLEAN = "BOOLEAN",
|
|
9
|
-
NULL = "NULL",
|
|
10
|
-
ARRAY_START = "ARRAY_START",
|
|
11
|
-
ARRAY_END = "ARRAY_END",
|
|
12
|
-
DICT_START = "DICT_START",
|
|
13
|
-
DICT_END = "DICT_END",
|
|
14
|
-
OBJ = "OBJ",
|
|
15
|
-
ENDOBJ = "ENDOBJ",
|
|
16
|
-
STREAM = "STREAM",
|
|
17
|
-
ENDSTREAM = "ENDSTREAM",
|
|
18
|
-
XREF = "XREF",
|
|
19
|
-
TRAILER = "TRAILER",
|
|
20
|
-
STARTXREF = "STARTXREF",
|
|
21
|
-
R = "R",
|
|
22
|
-
EOF = "EOF"
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* PDF token
|
|
26
|
-
*/
|
|
27
|
-
interface Token {
|
|
28
|
-
type: TokenType;
|
|
29
|
-
value: any;
|
|
30
|
-
position: number;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* PDF Lexer
|
|
34
|
-
*/
|
|
35
|
-
declare class PDFLexer {
|
|
36
|
-
private data;
|
|
37
|
-
private position;
|
|
38
|
-
constructor(data: Uint8Array);
|
|
39
|
-
/**
|
|
40
|
-
* Get next token
|
|
41
|
-
*/
|
|
42
|
-
nextToken(): Token;
|
|
43
|
-
/**
|
|
44
|
-
* Peek at next character without consuming
|
|
45
|
-
*/
|
|
46
|
-
private peek;
|
|
47
|
-
/**
|
|
48
|
-
* Skip whitespace and comments
|
|
49
|
-
*/
|
|
50
|
-
private skipWhitespace;
|
|
51
|
-
/**
|
|
52
|
-
* Read a name token
|
|
53
|
-
*/
|
|
54
|
-
private readName;
|
|
55
|
-
/**
|
|
56
|
-
* Read a string token
|
|
57
|
-
*/
|
|
58
|
-
private readString;
|
|
59
|
-
/**
|
|
60
|
-
* Read a number token
|
|
61
|
-
*/
|
|
62
|
-
private readNumber;
|
|
63
|
-
/**
|
|
64
|
-
* Read a keyword token
|
|
65
|
-
*/
|
|
66
|
-
private readKeyword;
|
|
67
|
-
/**
|
|
68
|
-
* Check if character is delimiter
|
|
69
|
-
*/
|
|
70
|
-
private isDelimiter;
|
|
71
|
-
/**
|
|
72
|
-
* Check if byte is whitespace
|
|
73
|
-
*/
|
|
74
|
-
private isWhitespace;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* PDF reference to indirect object
|
|
78
|
-
*/
|
|
79
|
-
type PDFRef = {
|
|
80
|
-
readonly objectNumber: number;
|
|
81
|
-
readonly generation: number;
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* PDF value types
|
|
85
|
-
*/
|
|
86
|
-
type PDFValue = boolean | number | string | PDFName | PDFArray | PDFDictionary | PDFStream | null | PDFRef;
|
|
87
|
-
/**
|
|
88
|
-
* PDF Name object
|
|
89
|
-
*/
|
|
90
|
-
type PDFName = {
|
|
91
|
-
readonly type: "name";
|
|
92
|
-
readonly value: string;
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* PDF Array
|
|
96
|
-
*/
|
|
97
|
-
type PDFArray = PDFValue[];
|
|
98
|
-
/**
|
|
99
|
-
* PDF Dictionary
|
|
100
|
-
*/
|
|
101
|
-
type PDFDictionary = Record<string, PDFValue>;
|
|
102
|
-
/**
|
|
103
|
-
* PDF Stream
|
|
104
|
-
*/
|
|
105
|
-
type PDFStream = {
|
|
106
|
-
readonly dictionary: PDFDictionary;
|
|
107
|
-
readonly data: Uint8Array;
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* PDF Parser
|
|
111
|
-
*/
|
|
112
|
-
declare class PDFParser {
|
|
113
|
-
private lexer;
|
|
114
|
-
private currentToken;
|
|
115
|
-
private nextToken;
|
|
116
|
-
private data;
|
|
117
|
-
constructor(data: Uint8Array);
|
|
118
|
-
/**
|
|
119
|
-
* Parse a PDF value
|
|
120
|
-
*/
|
|
121
|
-
parseValue(): PDFValue;
|
|
122
|
-
/**
|
|
123
|
-
* Parse number or reference (number number R)
|
|
124
|
-
*/
|
|
125
|
-
private parseNumberOrRef;
|
|
126
|
-
/**
|
|
127
|
-
* Parse string
|
|
128
|
-
*/
|
|
129
|
-
private parseString;
|
|
130
|
-
/**
|
|
131
|
-
* Parse name
|
|
132
|
-
*/
|
|
133
|
-
private parseName;
|
|
134
|
-
/**
|
|
135
|
-
* Parse boolean
|
|
136
|
-
*/
|
|
137
|
-
private parseBoolean;
|
|
138
|
-
/**
|
|
139
|
-
* Parse null
|
|
140
|
-
*/
|
|
141
|
-
private parseNull;
|
|
142
|
-
/**
|
|
143
|
-
* Parse array
|
|
144
|
-
*/
|
|
145
|
-
private parseArray;
|
|
146
|
-
/**
|
|
147
|
-
* Parse dictionary
|
|
148
|
-
*/
|
|
149
|
-
private parseDictionary;
|
|
150
|
-
/**
|
|
151
|
-
* Parse indirect object
|
|
152
|
-
*/
|
|
153
|
-
parseIndirectObject(): {
|
|
154
|
-
ref: PDFRef;
|
|
155
|
-
value: PDFValue;
|
|
156
|
-
};
|
|
157
|
-
/**
|
|
158
|
-
* Parse stream (dictionary already parsed)
|
|
159
|
-
*/
|
|
160
|
-
private parseStream;
|
|
161
|
-
/**
|
|
162
|
-
* Advance to next token
|
|
163
|
-
*/
|
|
164
|
-
private advance;
|
|
165
|
-
/**
|
|
166
|
-
* Check if more tokens available
|
|
167
|
-
*/
|
|
168
|
-
hasMore(): boolean;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Parsed PDF Document
|
|
172
|
-
*/
|
|
173
|
-
interface ParsedPDF {
|
|
174
|
-
version: string;
|
|
175
|
-
catalog: PDFRef;
|
|
176
|
-
pages: PDFPage[];
|
|
177
|
-
objects: Map<number, any>;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Parsed PDF Page
|
|
181
|
-
*/
|
|
182
|
-
interface PDFPage {
|
|
183
|
-
ref: PDFRef;
|
|
184
|
-
size: {
|
|
185
|
-
width: number;
|
|
186
|
-
height: number;
|
|
187
|
-
};
|
|
188
|
-
content: string;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* PDF Reader - reads and parses existing PDFs
|
|
192
|
-
*/
|
|
193
|
-
declare class PDFReader {
|
|
194
|
-
private data;
|
|
195
|
-
private objects;
|
|
196
|
-
constructor(data: Uint8Array);
|
|
197
|
-
/**
|
|
198
|
-
* Parse PDF file
|
|
199
|
-
*/
|
|
200
|
-
parse(): ParsedPDF;
|
|
201
|
-
/**
|
|
202
|
-
* Find startxref offset
|
|
203
|
-
*/
|
|
204
|
-
private findStartXRef;
|
|
205
|
-
/**
|
|
206
|
-
* Parse xref table
|
|
207
|
-
*/
|
|
208
|
-
private parseXRefTable;
|
|
209
|
-
/**
|
|
210
|
-
* Parse trailer dictionary
|
|
211
|
-
*/
|
|
212
|
-
private parseTrailer;
|
|
213
|
-
/**
|
|
214
|
-
* Read all objects from xref table
|
|
215
|
-
*/
|
|
216
|
-
private readObjects;
|
|
217
|
-
/**
|
|
218
|
-
* Parse PDF version from header
|
|
219
|
-
*/
|
|
220
|
-
private parseVersion;
|
|
221
|
-
/**
|
|
222
|
-
* Parse pages from catalog
|
|
223
|
-
*/
|
|
224
|
-
private parsePages;
|
|
225
|
-
/**
|
|
226
|
-
* Parse a single page
|
|
227
|
-
*/
|
|
228
|
-
private parsePage;
|
|
229
|
-
/**
|
|
230
|
-
* Extract text from content stream
|
|
231
|
-
*/
|
|
232
|
-
private extractText;
|
|
233
|
-
}
|
|
234
|
-
export { TokenType, Token, ParsedPDF, PDFReader, PDFParser, PDFPage, PDFLexer };
|
package/dist/parsing/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PDFLexer,
|
|
3
|
-
PDFParser,
|
|
4
|
-
PDFReader,
|
|
5
|
-
TokenType
|
|
6
|
-
} from "../shared/chunk-10ftnz45.js";
|
|
7
|
-
import"../shared/chunk-6dengthp.js";
|
|
8
|
-
export {
|
|
9
|
-
TokenType,
|
|
10
|
-
PDFReader,
|
|
11
|
-
PDFParser,
|
|
12
|
-
PDFLexer
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
//# debugId=1306B1E9F61CD14B64756E2164756E21
|
|
16
|
-
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFtdLAogICJzb3VyY2VzQ29udGVudCI6IFsKICBdLAogICJtYXBwaW5ncyI6ICIiLAogICJkZWJ1Z0lkIjogIjEzMDZCMUU5RjYxQ0QxNEI2NDc1NkUyMTY0NzU2RTIxIiwKICAibmFtZXMiOiBbXQp9
|