@lpdfio/lpdf 0.21.0 → 0.23.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/LICENSE +1 -1
- package/README.md +6 -12
- package/dist/L.d.ts +34 -33
- package/dist/L.js +2 -1
- package/dist/_shared.d.ts +4 -3
- package/dist/_shared.js +15 -0
- package/dist/attrs.d.ts +493 -0
- package/dist/attrs.js +4 -0
- package/dist/browser.js +47 -0
- package/dist/canvas.d.ts +24 -87
- package/dist/canvas.js +22 -134
- package/dist/constants.d.ts +50 -0
- package/dist/constants.js +50 -0
- package/dist/engine.js +19 -15
- package/dist/index.d.ts +5 -4
- package/dist/index.js +8 -1
- package/dist/kit.d.ts +19 -16
- package/dist/kit.js +10 -20
- package/dist/layout.d.ts +18 -203
- package/dist/layout.js +37 -92
- package/dist/wasm/lpdf_bg.wasm +0 -0
- package/package.json +4 -1
package/dist/attrs.d.ts
ADDED
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Places children top to bottom, each at the full width, with gap between them. Can split across
|
|
3
|
+
* pages between children.
|
|
4
|
+
*/
|
|
5
|
+
export interface StackAttr {
|
|
6
|
+
font?: string;
|
|
7
|
+
fontSize?: string;
|
|
8
|
+
gap?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Space between the edge of the box and its content, written like CSS: one value for all sides,
|
|
11
|
+
* two for top-bottom and left-right, three for top, left-right and bottom, four for top, right,
|
|
12
|
+
* bottom and left.
|
|
13
|
+
*/
|
|
14
|
+
padding?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Height of the box. Leave it out to size to the content. A length fixes it; fill takes what is
|
|
17
|
+
* left after its siblings (shared equally if several use fill); full takes all the height
|
|
18
|
+
* available. Any of these stops the box splitting across pages.
|
|
19
|
+
*/
|
|
20
|
+
height?: string;
|
|
21
|
+
background?: string;
|
|
22
|
+
border?: string;
|
|
23
|
+
radius?: string;
|
|
24
|
+
debug?: string;
|
|
25
|
+
align?: string;
|
|
26
|
+
justify?: string;
|
|
27
|
+
width?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* One row where the children keep their own width except one, which fills the rest. By default the
|
|
31
|
+
* last child fills; set end to true and the first fills. Never splits across pages.
|
|
32
|
+
*/
|
|
33
|
+
export interface FlankAttr {
|
|
34
|
+
font?: string;
|
|
35
|
+
fontSize?: string;
|
|
36
|
+
gap?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Space between the edge of the box and its content, written like CSS: one value for all sides,
|
|
39
|
+
* two for top-bottom and left-right, three for top, left-right and bottom, four for top, right,
|
|
40
|
+
* bottom and left.
|
|
41
|
+
*/
|
|
42
|
+
padding?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Height of the box. Leave it out to size to the content. A length fixes it; fill takes what is
|
|
45
|
+
* left after its siblings (shared equally if several use fill); full takes all the height
|
|
46
|
+
* available. Any of these stops the box splitting across pages.
|
|
47
|
+
*/
|
|
48
|
+
height?: string;
|
|
49
|
+
background?: string;
|
|
50
|
+
border?: string;
|
|
51
|
+
radius?: string;
|
|
52
|
+
debug?: string;
|
|
53
|
+
align?: string;
|
|
54
|
+
/**
|
|
55
|
+
* false (the default): every child but the last keeps its own width at the left, and the last
|
|
56
|
+
* fills the rest. true: the first child fills, and the others keep their own width at the right.
|
|
57
|
+
*/
|
|
58
|
+
end?: string;
|
|
59
|
+
width?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Two children side by side; any further children are ignored. By default each keeps its own width,
|
|
63
|
+
* the first at the left edge and the second at the right. With equal set to true they take half the
|
|
64
|
+
* width each. Never splits across pages.
|
|
65
|
+
*/
|
|
66
|
+
export interface SplitAttr {
|
|
67
|
+
font?: string;
|
|
68
|
+
fontSize?: string;
|
|
69
|
+
gap?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Space between the edge of the box and its content, written like CSS: one value for all sides,
|
|
72
|
+
* two for top-bottom and left-right, three for top, left-right and bottom, four for top, right,
|
|
73
|
+
* bottom and left.
|
|
74
|
+
*/
|
|
75
|
+
padding?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Height of the box. Leave it out to size to the content. A length fixes it; fill takes what is
|
|
78
|
+
* left after its siblings (shared equally if several use fill); full takes all the height
|
|
79
|
+
* available. Any of these stops the box splitting across pages.
|
|
80
|
+
*/
|
|
81
|
+
height?: string;
|
|
82
|
+
background?: string;
|
|
83
|
+
border?: string;
|
|
84
|
+
radius?: string;
|
|
85
|
+
debug?: string;
|
|
86
|
+
align?: string;
|
|
87
|
+
/**
|
|
88
|
+
* false (the default): each child keeps its own width, the first at the left edge and the second
|
|
89
|
+
* at the right edge. true: the two children share the width in equal halves.
|
|
90
|
+
*/
|
|
91
|
+
equal?: string;
|
|
92
|
+
width?: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A row that wraps: children sit side by side, and continue on the next line when they run out of
|
|
96
|
+
* width. Splits across pages between lines.
|
|
97
|
+
*/
|
|
98
|
+
export interface ClusterAttr {
|
|
99
|
+
font?: string;
|
|
100
|
+
fontSize?: string;
|
|
101
|
+
gap?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Space between the edge of the box and its content, written like CSS: one value for all sides,
|
|
104
|
+
* two for top-bottom and left-right, three for top, left-right and bottom, four for top, right,
|
|
105
|
+
* bottom and left.
|
|
106
|
+
*/
|
|
107
|
+
padding?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Height of the box. Leave it out to size to the content. A length fixes it; fill takes what is
|
|
110
|
+
* left after its siblings (shared equally if several use fill); full takes all the height
|
|
111
|
+
* available. Any of these stops the box splitting across pages.
|
|
112
|
+
*/
|
|
113
|
+
height?: string;
|
|
114
|
+
background?: string;
|
|
115
|
+
border?: string;
|
|
116
|
+
radius?: string;
|
|
117
|
+
debug?: string;
|
|
118
|
+
align?: string;
|
|
119
|
+
justify?: string;
|
|
120
|
+
width?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Fills a fixed number of equal columns from left to right, then starts a new row. A row never
|
|
124
|
+
* splits across pages. For data with a header row, use table.
|
|
125
|
+
*/
|
|
126
|
+
export interface GridAttr {
|
|
127
|
+
font?: string;
|
|
128
|
+
fontSize?: string;
|
|
129
|
+
gap?: string;
|
|
130
|
+
/**
|
|
131
|
+
* Space between the edge of the box and its content, written like CSS: one value for all sides,
|
|
132
|
+
* two for top-bottom and left-right, three for top, left-right and bottom, four for top, right,
|
|
133
|
+
* bottom and left.
|
|
134
|
+
*/
|
|
135
|
+
padding?: string;
|
|
136
|
+
/**
|
|
137
|
+
* Height of the box. Leave it out to size to the content. A length fixes it; fill takes what is
|
|
138
|
+
* left after its siblings (shared equally if several use fill); full takes all the height
|
|
139
|
+
* available. Any of these stops the box splitting across pages.
|
|
140
|
+
*/
|
|
141
|
+
height?: string;
|
|
142
|
+
background?: string;
|
|
143
|
+
border?: string;
|
|
144
|
+
radius?: string;
|
|
145
|
+
debug?: string;
|
|
146
|
+
width?: string;
|
|
147
|
+
colWidth?: string;
|
|
148
|
+
cols?: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* A box around a single child, which it centres. Never splits across pages: if it does not fit, the
|
|
152
|
+
* whole box moves to the next page.
|
|
153
|
+
*/
|
|
154
|
+
export interface FrameAttr {
|
|
155
|
+
font?: string;
|
|
156
|
+
fontSize?: string;
|
|
157
|
+
/**
|
|
158
|
+
* Space between the edge of the box and its content, written like CSS: one value for all sides,
|
|
159
|
+
* two for top-bottom and left-right, three for top, left-right and bottom, four for top, right,
|
|
160
|
+
* bottom and left.
|
|
161
|
+
*/
|
|
162
|
+
padding?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Height of the box. Leave it out to size to the content. A length fixes it; fill takes what is
|
|
165
|
+
* left after its siblings (shared equally if several use fill); full takes all the height
|
|
166
|
+
* available. Any of these stops the box splitting across pages.
|
|
167
|
+
*/
|
|
168
|
+
height?: string;
|
|
169
|
+
background?: string;
|
|
170
|
+
border?: string;
|
|
171
|
+
radius?: string;
|
|
172
|
+
debug?: string;
|
|
173
|
+
width?: string;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Attributes of the `link` element.
|
|
177
|
+
*/
|
|
178
|
+
export interface LinkAttr {
|
|
179
|
+
href: string;
|
|
180
|
+
gap?: string;
|
|
181
|
+
width?: string;
|
|
182
|
+
height?: string;
|
|
183
|
+
debug?: string;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Attributes of the `divider` element.
|
|
187
|
+
*/
|
|
188
|
+
export interface DividerAttr {
|
|
189
|
+
direction?: string;
|
|
190
|
+
color?: string;
|
|
191
|
+
thickness?: string;
|
|
192
|
+
debug?: string;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Attributes of the `span` element.
|
|
196
|
+
*/
|
|
197
|
+
export interface SpanAttr {
|
|
198
|
+
font?: string;
|
|
199
|
+
bold?: string;
|
|
200
|
+
color?: string;
|
|
201
|
+
href?: string;
|
|
202
|
+
underline?: string;
|
|
203
|
+
strike?: string;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Attributes of the `img` element.
|
|
207
|
+
*/
|
|
208
|
+
export interface ImgAttr {
|
|
209
|
+
name: string;
|
|
210
|
+
height?: string;
|
|
211
|
+
width?: string;
|
|
212
|
+
font?: string;
|
|
213
|
+
fontSize?: string;
|
|
214
|
+
gap?: string;
|
|
215
|
+
padding?: string;
|
|
216
|
+
background?: string;
|
|
217
|
+
border?: string;
|
|
218
|
+
radius?: string;
|
|
219
|
+
debug?: string;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Attributes of the `barcode` element.
|
|
223
|
+
*/
|
|
224
|
+
export interface BarcodeAttr {
|
|
225
|
+
type: string;
|
|
226
|
+
data: string;
|
|
227
|
+
size?: string;
|
|
228
|
+
width?: string;
|
|
229
|
+
height?: string;
|
|
230
|
+
ec?: string;
|
|
231
|
+
hrt?: string;
|
|
232
|
+
color?: string;
|
|
233
|
+
background?: string;
|
|
234
|
+
debug?: string;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* A block of wrapping text. Use span children to style parts of it. Splits across pages between
|
|
238
|
+
* lines.
|
|
239
|
+
*/
|
|
240
|
+
export interface TextAttr {
|
|
241
|
+
fontSize?: string;
|
|
242
|
+
font?: string;
|
|
243
|
+
/**
|
|
244
|
+
* Use the bold face of the font. It applies to the 14 built-in fonts: Helvetica becomes
|
|
245
|
+
* Helvetica-Bold, Times-Roman becomes Times-Bold, Courier becomes Courier-Bold, and the oblique
|
|
246
|
+
* and italic faces their bold forms. A custom font has no bold face to pick, so name one in font.
|
|
247
|
+
*/
|
|
248
|
+
bold?: string;
|
|
249
|
+
color?: string;
|
|
250
|
+
align?: string;
|
|
251
|
+
width?: string;
|
|
252
|
+
debug?: string;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Attributes of the `td` element.
|
|
256
|
+
*/
|
|
257
|
+
export interface TdAttr {
|
|
258
|
+
font?: string;
|
|
259
|
+
fontSize?: string;
|
|
260
|
+
gap?: string;
|
|
261
|
+
/**
|
|
262
|
+
* Space between the edge of the box and its content, written like CSS: one value for all sides,
|
|
263
|
+
* two for top-bottom and left-right, three for top, left-right and bottom, four for top, right,
|
|
264
|
+
* bottom and left.
|
|
265
|
+
*/
|
|
266
|
+
padding?: string;
|
|
267
|
+
/**
|
|
268
|
+
* Height of the box. Leave it out to size to the content. A length fixes it; fill takes what is
|
|
269
|
+
* left after its siblings (shared equally if several use fill); full takes all the height
|
|
270
|
+
* available. Any of these stops the box splitting across pages.
|
|
271
|
+
*/
|
|
272
|
+
height?: string;
|
|
273
|
+
background?: string;
|
|
274
|
+
border?: string;
|
|
275
|
+
radius?: string;
|
|
276
|
+
debug?: string;
|
|
277
|
+
align?: string;
|
|
278
|
+
valign?: string;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Attributes of the `thead` element.
|
|
282
|
+
*/
|
|
283
|
+
export interface TheadAttr {
|
|
284
|
+
background?: string;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Attributes of the `tr` element.
|
|
288
|
+
*/
|
|
289
|
+
export interface TrAttr {
|
|
290
|
+
background?: string;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Rows and cells in columns whose widths are set by cols. The thead row repeats at the top of every
|
|
294
|
+
* page, and rows move between pages whole.
|
|
295
|
+
*/
|
|
296
|
+
export interface TableAttr {
|
|
297
|
+
/**
|
|
298
|
+
* Column widths, separated by spaces, in fr, pt or % units: for example 2fr 1fr 120pt 20%.
|
|
299
|
+
*/
|
|
300
|
+
cols: string;
|
|
301
|
+
border?: string;
|
|
302
|
+
stripe?: string;
|
|
303
|
+
gap?: string;
|
|
304
|
+
padding?: string;
|
|
305
|
+
background?: string;
|
|
306
|
+
width?: string;
|
|
307
|
+
height?: string;
|
|
308
|
+
debug?: string;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Attributes of the `field` element.
|
|
312
|
+
*/
|
|
313
|
+
export interface FieldAttr {
|
|
314
|
+
type: string;
|
|
315
|
+
name: string;
|
|
316
|
+
value?: string;
|
|
317
|
+
label?: string;
|
|
318
|
+
options?: string;
|
|
319
|
+
group?: string;
|
|
320
|
+
checked?: string;
|
|
321
|
+
required?: string;
|
|
322
|
+
readonly?: string;
|
|
323
|
+
maxLen?: string;
|
|
324
|
+
actionUrl?: string;
|
|
325
|
+
width?: string;
|
|
326
|
+
height?: string;
|
|
327
|
+
background?: string;
|
|
328
|
+
border?: string;
|
|
329
|
+
debug?: string;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Pins content to the top or bottom edge of pages, outside the normal flow, for headers and
|
|
333
|
+
* footers. It reserves that space on every page it appears on. Only allowed directly inside layout,
|
|
334
|
+
* and one per pin on a page.
|
|
335
|
+
*/
|
|
336
|
+
export interface RegionAttr {
|
|
337
|
+
/**
|
|
338
|
+
* Which edge the region sticks to. top and bottom work. left and right pass validation but are
|
|
339
|
+
* not implemented yet.
|
|
340
|
+
*/
|
|
341
|
+
pin: string;
|
|
342
|
+
/**
|
|
343
|
+
* Which pages show the region: each, first, last, odd, even, or a range such as 2-last. Defaults
|
|
344
|
+
* to each.
|
|
345
|
+
*/
|
|
346
|
+
page?: string;
|
|
347
|
+
w?: string;
|
|
348
|
+
debug?: string;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Groups canvas shapes and sets what applies to all of them: which pages they appear on, opacity,
|
|
352
|
+
* transform and clip. Layers cannot be nested.
|
|
353
|
+
*/
|
|
354
|
+
export interface LayerAttr {
|
|
355
|
+
page?: string;
|
|
356
|
+
opacity?: string;
|
|
357
|
+
transform?: string;
|
|
358
|
+
clip?: string;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Attributes of the `rect` element on the canvas.
|
|
362
|
+
*/
|
|
363
|
+
export interface RectAttr {
|
|
364
|
+
w: string;
|
|
365
|
+
h: string;
|
|
366
|
+
x?: string;
|
|
367
|
+
y?: string;
|
|
368
|
+
anchor?: string;
|
|
369
|
+
radius?: string;
|
|
370
|
+
fill?: string;
|
|
371
|
+
stroke?: string;
|
|
372
|
+
strokeWidth?: string;
|
|
373
|
+
strokeDash?: string;
|
|
374
|
+
opacity?: string;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Attributes of the `circle` element on the canvas.
|
|
378
|
+
*/
|
|
379
|
+
export interface CircleAttr {
|
|
380
|
+
r: string;
|
|
381
|
+
cx?: string;
|
|
382
|
+
cy?: string;
|
|
383
|
+
anchor?: string;
|
|
384
|
+
fill?: string;
|
|
385
|
+
stroke?: string;
|
|
386
|
+
strokeWidth?: string;
|
|
387
|
+
strokeDash?: string;
|
|
388
|
+
opacity?: string;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Attributes of the `ellipse` element on the canvas.
|
|
392
|
+
*/
|
|
393
|
+
export interface EllipseAttr {
|
|
394
|
+
rx: string;
|
|
395
|
+
ry: string;
|
|
396
|
+
cx?: string;
|
|
397
|
+
cy?: string;
|
|
398
|
+
anchor?: string;
|
|
399
|
+
fill?: string;
|
|
400
|
+
stroke?: string;
|
|
401
|
+
strokeWidth?: string;
|
|
402
|
+
strokeDash?: string;
|
|
403
|
+
opacity?: string;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Attributes of the `line` element on the canvas.
|
|
407
|
+
*/
|
|
408
|
+
export interface LineAttr {
|
|
409
|
+
x1: string;
|
|
410
|
+
y1: string;
|
|
411
|
+
x2: string;
|
|
412
|
+
y2: string;
|
|
413
|
+
stroke?: string;
|
|
414
|
+
strokeWidth?: string;
|
|
415
|
+
strokeDash?: string;
|
|
416
|
+
lineCap?: string;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Attributes of the `path` element on the canvas.
|
|
420
|
+
*/
|
|
421
|
+
export interface PathAttr {
|
|
422
|
+
d: string;
|
|
423
|
+
fill?: string;
|
|
424
|
+
stroke?: string;
|
|
425
|
+
fillRule?: string;
|
|
426
|
+
strokeWidth?: string;
|
|
427
|
+
strokeDash?: string;
|
|
428
|
+
lineCap?: string;
|
|
429
|
+
opacity?: string;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Text at an exact position on the page: either x and y, or an anchor with optional offsets.
|
|
433
|
+
*/
|
|
434
|
+
export interface CanvasTextAttr {
|
|
435
|
+
x?: string;
|
|
436
|
+
y?: string;
|
|
437
|
+
anchor?: string;
|
|
438
|
+
font?: string;
|
|
439
|
+
fontSize?: string;
|
|
440
|
+
color?: string;
|
|
441
|
+
align?: string;
|
|
442
|
+
w?: string;
|
|
443
|
+
lineHeight?: string;
|
|
444
|
+
opacity?: string;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Attributes of the `img` element on the canvas.
|
|
448
|
+
*/
|
|
449
|
+
export interface CanvasImgAttr {
|
|
450
|
+
name: string;
|
|
451
|
+
w: string;
|
|
452
|
+
h: string;
|
|
453
|
+
x?: string;
|
|
454
|
+
y?: string;
|
|
455
|
+
anchor?: string;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Declares a font that text can be set in by name, with the font attribute. A built-in PDF font is
|
|
459
|
+
* named by core; any other font is a file the SDK reads from src, or one loaded on the engine under
|
|
460
|
+
* ref or, with no ref, under the font's own name.
|
|
461
|
+
*/
|
|
462
|
+
export interface FontAttr {
|
|
463
|
+
/**
|
|
464
|
+
* The name that the font attribute of a text uses to pick this font: lowercase letters, digits
|
|
465
|
+
* and -, starting with a letter.
|
|
466
|
+
*/
|
|
467
|
+
name: string;
|
|
468
|
+
/** A built-in PDF font, which needs no file. */
|
|
469
|
+
core?: string;
|
|
470
|
+
/** The key the font was loaded under on the engine, when that is not its name. */
|
|
471
|
+
ref?: string;
|
|
472
|
+
/**
|
|
473
|
+
* A path the SDK reads the font file from, when the font was not loaded on the engine.
|
|
474
|
+
*/
|
|
475
|
+
src?: string;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Declares an image that an img refers to by name. The SDK reads the file from src, or the image
|
|
479
|
+
* was loaded on the engine under ref or, with no ref, under its own name.
|
|
480
|
+
*/
|
|
481
|
+
export interface ImageAttr {
|
|
482
|
+
/**
|
|
483
|
+
* The name that the name attribute of an img uses to pick this image: lowercase letters, digits
|
|
484
|
+
* and -, starting with a letter.
|
|
485
|
+
*/
|
|
486
|
+
name: string;
|
|
487
|
+
/** The key the image was loaded under on the engine, when that is not its name. */
|
|
488
|
+
ref?: string;
|
|
489
|
+
/**
|
|
490
|
+
* A path the SDK reads the image file from, when the image was not loaded on the engine.
|
|
491
|
+
*/
|
|
492
|
+
src?: string;
|
|
493
|
+
}
|
package/dist/attrs.js
ADDED
package/dist/browser.js
CHANGED
|
@@ -392,6 +392,48 @@ async function __wbg_init(module_or_path) {
|
|
|
392
392
|
return __wbg_finalize_init(instance, module);
|
|
393
393
|
}
|
|
394
394
|
|
|
395
|
+
// src/constants.ts
|
|
396
|
+
var FieldType = {
|
|
397
|
+
Text: "text",
|
|
398
|
+
Checkbox: "checkbox",
|
|
399
|
+
Dropdown: "dropdown",
|
|
400
|
+
Radio: "radio",
|
|
401
|
+
Button: "button"
|
|
402
|
+
};
|
|
403
|
+
var Pin = {
|
|
404
|
+
Top: "top",
|
|
405
|
+
Bottom: "bottom",
|
|
406
|
+
Left: "left",
|
|
407
|
+
Right: "right"
|
|
408
|
+
};
|
|
409
|
+
var Orientation = {
|
|
410
|
+
Portrait: "portrait",
|
|
411
|
+
Landscape: "landscape"
|
|
412
|
+
};
|
|
413
|
+
var BuiltinFont = {
|
|
414
|
+
Courier: "Courier",
|
|
415
|
+
CourierBold: "Courier-Bold",
|
|
416
|
+
CourierOblique: "Courier-Oblique",
|
|
417
|
+
CourierBoldOblique: "Courier-BoldOblique",
|
|
418
|
+
Helvetica: "Helvetica",
|
|
419
|
+
HelveticaBold: "Helvetica-Bold",
|
|
420
|
+
HelveticaOblique: "Helvetica-Oblique",
|
|
421
|
+
HelveticaBoldOblique: "Helvetica-BoldOblique",
|
|
422
|
+
TimesRoman: "Times-Roman",
|
|
423
|
+
TimesBold: "Times-Bold",
|
|
424
|
+
TimesItalic: "Times-Italic",
|
|
425
|
+
TimesBoldItalic: "Times-BoldItalic",
|
|
426
|
+
Symbol: "Symbol",
|
|
427
|
+
ZapfDingbats: "ZapfDingbats"
|
|
428
|
+
};
|
|
429
|
+
var PageScope = {
|
|
430
|
+
Each: "each",
|
|
431
|
+
First: "first",
|
|
432
|
+
Last: "last",
|
|
433
|
+
Odd: "odd",
|
|
434
|
+
Even: "even"
|
|
435
|
+
};
|
|
436
|
+
|
|
395
437
|
// src/browser.ts
|
|
396
438
|
var NoAttr = null;
|
|
397
439
|
function nowUnix() {
|
|
@@ -443,6 +485,11 @@ async function initLpdf(wasmSource, licenseKey = "") {
|
|
|
443
485
|
};
|
|
444
486
|
}
|
|
445
487
|
export {
|
|
488
|
+
BuiltinFont,
|
|
489
|
+
FieldType,
|
|
446
490
|
NoAttr,
|
|
491
|
+
Orientation,
|
|
492
|
+
PageScope,
|
|
493
|
+
Pin,
|
|
447
494
|
initLpdf
|
|
448
495
|
};
|
package/dist/canvas.d.ts
CHANGED
|
@@ -1,57 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
stroke?: string;
|
|
8
|
-
strokeWidth?: number;
|
|
9
|
-
strokeDash?: number[];
|
|
10
|
-
borderRadius?: number;
|
|
11
|
-
opacity?: number;
|
|
12
|
-
anchor?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface CanvasLineStyle {
|
|
15
|
-
stroke?: string;
|
|
16
|
-
strokeWidth?: number;
|
|
17
|
-
strokeDash?: number[];
|
|
18
|
-
lineCap?: LineCap;
|
|
19
|
-
lineJoin?: LineJoin;
|
|
20
|
-
}
|
|
21
|
-
export interface CanvasEllipseStyle {
|
|
22
|
-
fill?: string;
|
|
23
|
-
stroke?: string;
|
|
24
|
-
strokeWidth?: number;
|
|
25
|
-
strokeDash?: number[];
|
|
26
|
-
opacity?: number;
|
|
27
|
-
anchor?: string;
|
|
28
|
-
}
|
|
29
|
-
export interface CanvasPathStyle {
|
|
30
|
-
fill?: string;
|
|
31
|
-
stroke?: string;
|
|
32
|
-
strokeWidth?: number;
|
|
33
|
-
strokeDash?: number[];
|
|
34
|
-
fillRuleEvenodd?: boolean;
|
|
35
|
-
lineCap?: LineCap;
|
|
36
|
-
lineJoin?: LineJoin;
|
|
37
|
-
opacity?: number;
|
|
38
|
-
}
|
|
39
|
-
export interface CanvasTextStyle {
|
|
40
|
-
font?: string;
|
|
41
|
-
size?: number;
|
|
42
|
-
color?: string;
|
|
43
|
-
align?: TextAlign;
|
|
44
|
-
lineHeight?: number;
|
|
45
|
-
width?: number;
|
|
46
|
-
opacity?: number;
|
|
47
|
-
anchor?: string;
|
|
48
|
-
}
|
|
49
|
-
export interface CanvasRun {
|
|
50
|
-
text: string;
|
|
51
|
-
font?: string;
|
|
52
|
-
size?: number;
|
|
53
|
-
color?: string;
|
|
54
|
-
}
|
|
1
|
+
import type { RectAttr, CircleAttr, EllipseAttr, LineAttr, PathAttr, CanvasTextAttr, CanvasImgAttr, LayerAttr } from './attrs';
|
|
2
|
+
import type { LpdfSpanNode } from './layout';
|
|
3
|
+
/**
|
|
4
|
+
* Builds the `transform` string of a layer. `String(CanvasTransform.rotate(45))` is
|
|
5
|
+
* `matrix(...)`, which a layer's `transform` attribute accepts like `rotate(45)`.
|
|
6
|
+
*/
|
|
55
7
|
export declare class CanvasTransform {
|
|
56
8
|
readonly matrix: number[];
|
|
57
9
|
constructor(matrix: number[]);
|
|
@@ -66,67 +18,52 @@ export declare class CanvasTransform {
|
|
|
66
18
|
* Equivalent to matrix multiplication: this × other.
|
|
67
19
|
*/
|
|
68
20
|
then(other: CanvasTransform): CanvasTransform;
|
|
69
|
-
/**
|
|
21
|
+
/** The `"matrix(a,b,c,d,e,f)"` form of the transform. */
|
|
70
22
|
toString(): string;
|
|
71
23
|
}
|
|
72
24
|
export interface LpdfCanvasRectNode {
|
|
73
|
-
type: '
|
|
25
|
+
type: 'rect';
|
|
74
26
|
attrs: Record<string, string>;
|
|
75
27
|
}
|
|
76
28
|
export interface LpdfCanvasLineNode {
|
|
77
|
-
type: '
|
|
29
|
+
type: 'line';
|
|
78
30
|
attrs: Record<string, string>;
|
|
79
31
|
}
|
|
80
32
|
export interface LpdfCanvasEllipseNode {
|
|
81
|
-
type: '
|
|
33
|
+
type: 'ellipse';
|
|
82
34
|
attrs: Record<string, string>;
|
|
83
35
|
}
|
|
84
36
|
export interface LpdfCanvasCircleNode {
|
|
85
|
-
type: '
|
|
37
|
+
type: 'circle';
|
|
86
38
|
attrs: Record<string, string>;
|
|
87
39
|
}
|
|
88
40
|
export interface LpdfCanvasPathNode {
|
|
89
|
-
type: '
|
|
41
|
+
type: 'path';
|
|
90
42
|
attrs: Record<string, string>;
|
|
91
43
|
}
|
|
92
44
|
export interface LpdfCanvasTextNode {
|
|
93
|
-
type: '
|
|
94
|
-
text: string;
|
|
45
|
+
type: 'text';
|
|
95
46
|
attrs: Record<string, string>;
|
|
96
|
-
|
|
97
|
-
text: string;
|
|
98
|
-
attrs: {
|
|
99
|
-
font?: string;
|
|
100
|
-
'font-size'?: string;
|
|
101
|
-
color?: string;
|
|
102
|
-
};
|
|
103
|
-
}[];
|
|
47
|
+
nodes: (string | LpdfSpanNode)[];
|
|
104
48
|
}
|
|
105
49
|
export interface LpdfCanvasImgNode {
|
|
106
|
-
type: '
|
|
50
|
+
type: 'img';
|
|
107
51
|
attrs: Record<string, string>;
|
|
108
52
|
}
|
|
109
53
|
export type LpdfCanvasPrimitiveNode = LpdfCanvasRectNode | LpdfCanvasLineNode | LpdfCanvasEllipseNode | LpdfCanvasCircleNode | LpdfCanvasPathNode | LpdfCanvasTextNode | LpdfCanvasImgNode;
|
|
110
|
-
/** @deprecated Use {@link LayerAttr} */
|
|
111
|
-
export type CanvasLayerOptions = LayerAttr;
|
|
112
|
-
export interface LayerAttr {
|
|
113
|
-
page?: PageScope | string;
|
|
114
|
-
opacity?: number;
|
|
115
|
-
transform?: CanvasTransform;
|
|
116
|
-
}
|
|
117
54
|
export interface LpdfCanvasLayerNode {
|
|
118
|
-
type: '
|
|
55
|
+
type: 'layer';
|
|
119
56
|
attrs: Record<string, string>;
|
|
120
57
|
nodes: LpdfCanvasPrimitiveNode[];
|
|
121
58
|
}
|
|
122
|
-
declare function rect(
|
|
123
|
-
declare function line(
|
|
124
|
-
declare function ellipse(
|
|
125
|
-
declare function circle(
|
|
126
|
-
declare function path(
|
|
127
|
-
declare function textAt(
|
|
128
|
-
declare function imgAt(
|
|
129
|
-
declare function layer(attrs: LayerAttr | null, nodes
|
|
59
|
+
declare function rect(attrs: RectAttr): LpdfCanvasRectNode;
|
|
60
|
+
declare function line(attrs: LineAttr): LpdfCanvasLineNode;
|
|
61
|
+
declare function ellipse(attrs: EllipseAttr): LpdfCanvasEllipseNode;
|
|
62
|
+
declare function circle(attrs: CircleAttr): LpdfCanvasCircleNode;
|
|
63
|
+
declare function path(attrs: PathAttr): LpdfCanvasPathNode;
|
|
64
|
+
declare function textAt(attrs: CanvasTextAttr, nodes?: (string | LpdfSpanNode)[]): LpdfCanvasTextNode;
|
|
65
|
+
declare function imgAt(attrs: CanvasImgAttr): LpdfCanvasImgNode;
|
|
66
|
+
declare function layer(attrs: LayerAttr | null, nodes?: LpdfCanvasPrimitiveNode[]): LpdfCanvasLayerNode;
|
|
130
67
|
export declare const LpdfCanvas: Readonly<{
|
|
131
68
|
rect: typeof rect;
|
|
132
69
|
line: typeof line;
|