@muhammara/native-core 7.0.0-beta.3 → 7.0.0-rc.1
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/README.md +57 -7
- package/THIRD_PARTY_NOTICES.md +39 -0
- package/index.js +120 -1
- package/lib/PDFRStreamForBuffer.js +52 -7
- package/lib/PDFRStreamForFile.js +56 -7
- package/lib/PDFStreamForResponse.js +22 -5
- package/lib/PDFWStreamForBuffer.js +49 -10
- package/lib/PDFWStreamForFile.js +26 -5
- package/lib/Recipe.js +86 -30
- package/lib/content-stream.js +503 -0
- package/lib/css-colors.js +149 -0
- package/lib/font-text.js +1461 -0
- package/lib/glyph-list.js +1127 -0
- package/lib/recipe/annotation.js +482 -105
- package/lib/recipe/appendPage.js +8 -1
- package/lib/recipe/colors.js +132 -35
- package/lib/recipe/coordinate.js +82 -16
- package/lib/recipe/encrypt.js +32 -13
- package/lib/recipe/font.js +70 -25
- package/lib/recipe/graphics-state.js +3 -2
- package/lib/recipe/htmlToTextObjects.js +154 -21
- package/lib/recipe/image.js +34 -9
- package/lib/recipe/info.js +93 -22
- package/lib/recipe/insertPage.js +12 -3
- package/lib/recipe/overlay.js +4 -2
- package/lib/recipe/page-references.js +436 -0
- package/lib/recipe/page.js +379 -275
- package/lib/recipe/parameters.js +11 -2
- package/lib/recipe/replaceText.js +464 -30
- package/lib/recipe/shapes.js +418 -45
- package/lib/recipe/split.js +6 -2
- package/lib/recipe/table.js +260 -173
- package/lib/recipe/text.helper.js +176 -10
- package/lib/recipe/text.js +420 -115
- package/lib/recipe/utils.js +66 -3
- package/lib/recipe/vector-line.js +101 -39
- package/lib/recipe/vector-polygon.js +18 -6
- package/lib/recipe/vector.helper.js +150 -13
- package/lib/recipe/vector.js +150 -53
- package/lib/recipe/xObjectForm.js +73 -10
- package/lib/recipe-constants.js +373 -0
- package/muhammara.d.ts +3487 -152
- package/package.json +1 -1
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
// Named values for Recipe string options. Recipe exposes each object as a
|
|
2
|
+
// static property, for example Recipe.AnnotSubtype.HIGHLIGHT; the plain
|
|
3
|
+
// strings stay accepted.
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Colorspaces accepted by the `colorspace` options of Recipe.
|
|
7
|
+
* @readonly
|
|
8
|
+
* @enum {string}
|
|
9
|
+
*/
|
|
10
|
+
var Colorspace = Object.freeze({
|
|
11
|
+
RGB: "rgb",
|
|
12
|
+
CMYK: "cmyk",
|
|
13
|
+
GRAY: "gray",
|
|
14
|
+
SEPARATION: "separation",
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Annotation subtypes (ISO 32000-1, 12.5.6).
|
|
19
|
+
* @readonly
|
|
20
|
+
* @enum {string}
|
|
21
|
+
*/
|
|
22
|
+
var AnnotSubtype = Object.freeze({
|
|
23
|
+
TEXT: "Text",
|
|
24
|
+
LINK: "Link",
|
|
25
|
+
FREE_TEXT: "FreeText",
|
|
26
|
+
LINE: "Line",
|
|
27
|
+
SQUARE: "Square",
|
|
28
|
+
CIRCLE: "Circle",
|
|
29
|
+
POLYGON: "Polygon",
|
|
30
|
+
POLY_LINE: "PolyLine",
|
|
31
|
+
HIGHLIGHT: "Highlight",
|
|
32
|
+
UNDERLINE: "Underline",
|
|
33
|
+
SQUIGGLY: "Squiggly",
|
|
34
|
+
STRIKE_OUT: "StrikeOut",
|
|
35
|
+
CARET: "Caret",
|
|
36
|
+
STAMP: "Stamp",
|
|
37
|
+
INK: "Ink",
|
|
38
|
+
POPUP: "Popup",
|
|
39
|
+
FILE_ATTACHMENT: "FileAttachment",
|
|
40
|
+
SOUND: "Sound",
|
|
41
|
+
MOVIE: "Movie",
|
|
42
|
+
SCREEN: "Screen",
|
|
43
|
+
WIDGET: "Widget",
|
|
44
|
+
PRINTER_MARK: "PrinterMark",
|
|
45
|
+
TRAP_NET: "TrapNet",
|
|
46
|
+
WATERMARK: "Watermark",
|
|
47
|
+
THREE_D: "3D",
|
|
48
|
+
REDACT: "Redact",
|
|
49
|
+
PROJECTION: "Projection",
|
|
50
|
+
RICH_MEDIA: "RichMedia",
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Annotation flag names (ISO 32000-1, 12.5.3). Matched case-insensitively.
|
|
55
|
+
* @readonly
|
|
56
|
+
* @enum {string}
|
|
57
|
+
*/
|
|
58
|
+
var AnnotFlag = Object.freeze({
|
|
59
|
+
INVISIBLE: "invisible",
|
|
60
|
+
HIDDEN: "hidden",
|
|
61
|
+
PRINT: "print",
|
|
62
|
+
NO_ZOOM: "nozoom",
|
|
63
|
+
NO_ROTATE: "norotate",
|
|
64
|
+
NO_VIEW: "noview",
|
|
65
|
+
READ_ONLY: "readonly",
|
|
66
|
+
LOCKED: "locked",
|
|
67
|
+
TOGGLE_NO_VIEW: "togglenoview",
|
|
68
|
+
LOCKED_CONTENTS: "lockedcontents",
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Text annotation icon names (ISO 32000-1, 12.5.6.4).
|
|
73
|
+
* @readonly
|
|
74
|
+
* @enum {string}
|
|
75
|
+
*/
|
|
76
|
+
var AnnotIcon = Object.freeze({
|
|
77
|
+
COMMENT: "Comment",
|
|
78
|
+
KEY: "Key",
|
|
79
|
+
NOTE: "Note",
|
|
80
|
+
HELP: "Help",
|
|
81
|
+
NEW_PARAGRAPH: "NewParagraph",
|
|
82
|
+
PARAGRAPH: "Paragraph",
|
|
83
|
+
INSERT: "Insert",
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Special `chroma()` names that run a command instead of naming a color.
|
|
88
|
+
* @readonly
|
|
89
|
+
* @enum {string}
|
|
90
|
+
*/
|
|
91
|
+
var ChromaCommand = Object.freeze({
|
|
92
|
+
/** Merge the color definitions from the JSON file given as the value. */
|
|
93
|
+
LOAD: "!load",
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Named Recipe coordinates.
|
|
98
|
+
* @readonly
|
|
99
|
+
* @enum {string}
|
|
100
|
+
*/
|
|
101
|
+
var Coordinate = Object.freeze({
|
|
102
|
+
/** The horizontal or vertical center of the page. */
|
|
103
|
+
CENTER: "center",
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* User access permission names for `permission()` (ISO 32000-1, table 22).
|
|
108
|
+
* @readonly
|
|
109
|
+
* @enum {string}
|
|
110
|
+
*/
|
|
111
|
+
var Permission = Object.freeze({
|
|
112
|
+
PRINT: "print",
|
|
113
|
+
MODIFY: "modify",
|
|
114
|
+
COPY: "copy",
|
|
115
|
+
EDIT: "edit",
|
|
116
|
+
FILL_FORM: "fillform",
|
|
117
|
+
EXTRACT: "extract",
|
|
118
|
+
ASSEMBLE: "assemble",
|
|
119
|
+
PRINT_BEST: "printbest",
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Font styles for `registerFont()`. The short forms r, b, i and bi are
|
|
124
|
+
* accepted as aliases.
|
|
125
|
+
* @readonly
|
|
126
|
+
* @enum {string}
|
|
127
|
+
*/
|
|
128
|
+
var FontStyle = Object.freeze({
|
|
129
|
+
REGULAR: "regular",
|
|
130
|
+
BOLD: "bold",
|
|
131
|
+
ITALIC: "italic",
|
|
132
|
+
BOLD_ITALIC: "bold-italic",
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Horizontal alignments, used as the first word of the image `align` option.
|
|
137
|
+
* @readonly
|
|
138
|
+
* @enum {string}
|
|
139
|
+
*/
|
|
140
|
+
var HorizontalAlign = Object.freeze({
|
|
141
|
+
LEFT: "left",
|
|
142
|
+
CENTER: "center",
|
|
143
|
+
RIGHT: "right",
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Vertical alignments, used as the second word of the image `align` option.
|
|
148
|
+
* @readonly
|
|
149
|
+
* @enum {string}
|
|
150
|
+
*/
|
|
151
|
+
var VerticalAlign = Object.freeze({
|
|
152
|
+
TOP: "top",
|
|
153
|
+
CENTER: "center",
|
|
154
|
+
BOTTOM: "bottom",
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Page orientations reported in page metadata.
|
|
159
|
+
* @readonly
|
|
160
|
+
* @enum {string}
|
|
161
|
+
*/
|
|
162
|
+
var PageLayout = Object.freeze({
|
|
163
|
+
PORTRAIT: "portrait",
|
|
164
|
+
LANDSCAPE: "landscape",
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Named page sizes for `createPage()`, matched case-insensitively; a "-size"
|
|
169
|
+
* suffix is ignored.
|
|
170
|
+
* @readonly
|
|
171
|
+
* @enum {string}
|
|
172
|
+
*/
|
|
173
|
+
var PageSize = Object.freeze({
|
|
174
|
+
EXECUTIVE: "executive",
|
|
175
|
+
FOLIO: "folio",
|
|
176
|
+
LEGAL: "legal",
|
|
177
|
+
LETTER: "letter",
|
|
178
|
+
LEDGER: "ledger",
|
|
179
|
+
TABLOID: "tabloid",
|
|
180
|
+
A0: "a0",
|
|
181
|
+
A1: "a1",
|
|
182
|
+
A2: "a2",
|
|
183
|
+
A3: "a3",
|
|
184
|
+
A4: "a4",
|
|
185
|
+
A5: "a5",
|
|
186
|
+
A6: "a6",
|
|
187
|
+
A7: "a7",
|
|
188
|
+
A8: "a8",
|
|
189
|
+
A9: "a9",
|
|
190
|
+
A10: "a10",
|
|
191
|
+
B0: "b0",
|
|
192
|
+
B1: "b1",
|
|
193
|
+
B2: "b2",
|
|
194
|
+
B3: "b3",
|
|
195
|
+
B4: "b4",
|
|
196
|
+
B5: "b5",
|
|
197
|
+
B6: "b6",
|
|
198
|
+
B7: "b7",
|
|
199
|
+
B8: "b8",
|
|
200
|
+
B9: "b9",
|
|
201
|
+
B10: "b10",
|
|
202
|
+
C0: "c0",
|
|
203
|
+
C1: "c1",
|
|
204
|
+
C2: "c2",
|
|
205
|
+
C3: "c3",
|
|
206
|
+
C4: "c4",
|
|
207
|
+
C5: "c5",
|
|
208
|
+
C6: "c6",
|
|
209
|
+
C7: "c7",
|
|
210
|
+
C8: "c8",
|
|
211
|
+
C9: "c9",
|
|
212
|
+
C10: "c10",
|
|
213
|
+
RA0: "ra0",
|
|
214
|
+
RA1: "ra1",
|
|
215
|
+
RA2: "ra2",
|
|
216
|
+
RA3: "ra3",
|
|
217
|
+
RA4: "ra4",
|
|
218
|
+
SRA0: "sra0",
|
|
219
|
+
SRA1: "sra1",
|
|
220
|
+
SRA2: "sra2",
|
|
221
|
+
SRA3: "sra3",
|
|
222
|
+
SRA4: "sra4",
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* How `triangle()` traits define the triangle. Matched case-insensitively.
|
|
227
|
+
* @readonly
|
|
228
|
+
* @enum {string}
|
|
229
|
+
*/
|
|
230
|
+
var TriangleTrait = Object.freeze({
|
|
231
|
+
/** Three side lengths. */
|
|
232
|
+
SSS: "sss",
|
|
233
|
+
/** Side, included angle, side: [sideA, angle C, sideB]. */
|
|
234
|
+
SAS: "sas",
|
|
235
|
+
/** Angle, side, angle: [angle B, sideC, angle A]. */
|
|
236
|
+
ASA: "asa",
|
|
237
|
+
/** Three vertex points [x, y]. */
|
|
238
|
+
VTX: "vtx",
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* The point of a triangle placed at the `triangle()` coordinates. Matched
|
|
243
|
+
* case-insensitively.
|
|
244
|
+
* @readonly
|
|
245
|
+
* @enum {string}
|
|
246
|
+
*/
|
|
247
|
+
var TrianglePosition = Object.freeze({
|
|
248
|
+
A: "a",
|
|
249
|
+
B: "b",
|
|
250
|
+
C: "c",
|
|
251
|
+
CENTROID: "centroid",
|
|
252
|
+
CIRCUMCENTER: "circumcenter",
|
|
253
|
+
INCENTER: "incenter",
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* The arrow point placed at the `arrow()` coordinates; the center when omitted.
|
|
258
|
+
* @readonly
|
|
259
|
+
* @enum {string}
|
|
260
|
+
*/
|
|
261
|
+
var ArrowAt = Object.freeze({
|
|
262
|
+
HEAD: "head",
|
|
263
|
+
TAIL: "tail",
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Arrow head shapes for the `arrow()` type option. The numbers 0, 1 and 2
|
|
268
|
+
* are accepted as aliases.
|
|
269
|
+
* @readonly
|
|
270
|
+
* @enum {string}
|
|
271
|
+
*/
|
|
272
|
+
var ArrowType = Object.freeze({
|
|
273
|
+
TRIANGLE: "triangle",
|
|
274
|
+
DART: "dart",
|
|
275
|
+
KITE: "kite",
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Line cap styles for the `lineCap` options.
|
|
280
|
+
* @readonly
|
|
281
|
+
* @enum {string}
|
|
282
|
+
*/
|
|
283
|
+
var LineCap = Object.freeze({
|
|
284
|
+
BUTT: "butt",
|
|
285
|
+
ROUND: "round",
|
|
286
|
+
SQUARE: "square",
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Line join styles for the `lineJoin` options.
|
|
291
|
+
* @readonly
|
|
292
|
+
* @enum {string}
|
|
293
|
+
*/
|
|
294
|
+
var LineJoin = Object.freeze({
|
|
295
|
+
MITER: "miter",
|
|
296
|
+
ROUND: "round",
|
|
297
|
+
BEVEL: "bevel",
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Which table rows the `row` options apply to; all rows when omitted.
|
|
302
|
+
* @readonly
|
|
303
|
+
* @enum {string}
|
|
304
|
+
*/
|
|
305
|
+
var TableRowNth = Object.freeze({
|
|
306
|
+
EVEN: "even",
|
|
307
|
+
ODD: "odd",
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* How text that does not fit a text-box line is handled. `true` is accepted
|
|
312
|
+
* for AUTO and `false` for ELLIPSIS.
|
|
313
|
+
* @readonly
|
|
314
|
+
* @enum {string}
|
|
315
|
+
*/
|
|
316
|
+
var TextWrap = Object.freeze({
|
|
317
|
+
/** Wrap onto the next line. */
|
|
318
|
+
AUTO: "auto",
|
|
319
|
+
/** Cut the line at the box edge. */
|
|
320
|
+
CLIP: "clip",
|
|
321
|
+
/** Drop the words that do not fit. */
|
|
322
|
+
TRIM: "trim",
|
|
323
|
+
/** Replace the text that does not fit with "...". */
|
|
324
|
+
ELLIPSIS: "ellipsis",
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Horizontal alignments of text inside a text box, the first word of the
|
|
329
|
+
* `textAlign` option.
|
|
330
|
+
* @readonly
|
|
331
|
+
* @enum {string}
|
|
332
|
+
*/
|
|
333
|
+
var TextAlign = Object.freeze({
|
|
334
|
+
LEFT: "left",
|
|
335
|
+
CENTER: "center",
|
|
336
|
+
RIGHT: "right",
|
|
337
|
+
JUSTIFY: "justify",
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Special Recipe sources.
|
|
342
|
+
* @readonly
|
|
343
|
+
* @enum {string}
|
|
344
|
+
*/
|
|
345
|
+
var Source = Object.freeze({
|
|
346
|
+
/** Create a new PDF instead of editing one; matched case-insensitively. */
|
|
347
|
+
NEW: "new",
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
module.exports = {
|
|
351
|
+
Source,
|
|
352
|
+
TextWrap,
|
|
353
|
+
TextAlign,
|
|
354
|
+
TableRowNth,
|
|
355
|
+
LineCap,
|
|
356
|
+
LineJoin,
|
|
357
|
+
ArrowAt,
|
|
358
|
+
ArrowType,
|
|
359
|
+
TriangleTrait,
|
|
360
|
+
TrianglePosition,
|
|
361
|
+
PageLayout,
|
|
362
|
+
PageSize,
|
|
363
|
+
HorizontalAlign,
|
|
364
|
+
VerticalAlign,
|
|
365
|
+
FontStyle,
|
|
366
|
+
Permission,
|
|
367
|
+
Coordinate,
|
|
368
|
+
Colorspace,
|
|
369
|
+
AnnotSubtype,
|
|
370
|
+
AnnotFlag,
|
|
371
|
+
AnnotIcon,
|
|
372
|
+
ChromaCommand,
|
|
373
|
+
};
|