@lpdfio/lpdf 0.22.0 → 0.24.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.
@@ -0,0 +1,560 @@
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
+ /**
25
+ * Where the box falls in the page flow. no: never split the box, and move it whole to the next
26
+ * page when it does not fit. break-before: start it on a new page. break-after: start the next
27
+ * sibling on a new page. keep-next: keep it on one page with the sibling that follows, moving
28
+ * both to the next page if that sibling would not fit. break-before, break-after and keep-next
29
+ * take effect on the children of layout; on a box inside another box they are not applied. no
30
+ * applies at any depth.
31
+ */
32
+ paginate?: string;
33
+ debug?: string;
34
+ align?: string;
35
+ justify?: string;
36
+ width?: string;
37
+ }
38
+ /**
39
+ * One row where the children keep their own width except one, which fills the rest. By default the
40
+ * last child fills; set end to true and the first fills. Never splits across pages.
41
+ */
42
+ export interface FlankAttr {
43
+ font?: string;
44
+ fontSize?: string;
45
+ gap?: string;
46
+ /**
47
+ * Space between the edge of the box and its content, written like CSS: one value for all sides,
48
+ * two for top-bottom and left-right, three for top, left-right and bottom, four for top, right,
49
+ * bottom and left.
50
+ */
51
+ padding?: string;
52
+ /**
53
+ * Height of the box. Leave it out to size to the content. A length fixes it; fill takes what is
54
+ * left after its siblings (shared equally if several use fill); full takes all the height
55
+ * available. Any of these stops the box splitting across pages.
56
+ */
57
+ height?: string;
58
+ background?: string;
59
+ border?: string;
60
+ radius?: string;
61
+ /**
62
+ * Where the box falls in the page flow. no: never split the box, and move it whole to the next
63
+ * page when it does not fit. break-before: start it on a new page. break-after: start the next
64
+ * sibling on a new page. keep-next: keep it on one page with the sibling that follows, moving
65
+ * both to the next page if that sibling would not fit. break-before, break-after and keep-next
66
+ * take effect on the children of layout; on a box inside another box they are not applied. no
67
+ * applies at any depth.
68
+ */
69
+ paginate?: string;
70
+ debug?: string;
71
+ align?: string;
72
+ /**
73
+ * false (the default): every child but the last keeps its own width at the left, and the last
74
+ * fills the rest. true: the first child fills, and the others keep their own width at the right.
75
+ */
76
+ end?: string;
77
+ width?: string;
78
+ }
79
+ /**
80
+ * Two children side by side; any further children are ignored. By default each keeps its own width,
81
+ * the first at the left edge and the second at the right. With equal set to true they take half the
82
+ * width each. Never splits across pages.
83
+ */
84
+ export interface SplitAttr {
85
+ font?: string;
86
+ fontSize?: string;
87
+ gap?: string;
88
+ /**
89
+ * Space between the edge of the box and its content, written like CSS: one value for all sides,
90
+ * two for top-bottom and left-right, three for top, left-right and bottom, four for top, right,
91
+ * bottom and left.
92
+ */
93
+ padding?: string;
94
+ /**
95
+ * Height of the box. Leave it out to size to the content. A length fixes it; fill takes what is
96
+ * left after its siblings (shared equally if several use fill); full takes all the height
97
+ * available. Any of these stops the box splitting across pages.
98
+ */
99
+ height?: string;
100
+ background?: string;
101
+ border?: string;
102
+ radius?: string;
103
+ /**
104
+ * Where the box falls in the page flow. no: never split the box, and move it whole to the next
105
+ * page when it does not fit. break-before: start it on a new page. break-after: start the next
106
+ * sibling on a new page. keep-next: keep it on one page with the sibling that follows, moving
107
+ * both to the next page if that sibling would not fit. break-before, break-after and keep-next
108
+ * take effect on the children of layout; on a box inside another box they are not applied. no
109
+ * applies at any depth.
110
+ */
111
+ paginate?: string;
112
+ debug?: string;
113
+ align?: string;
114
+ /**
115
+ * false (the default): each child keeps its own width, the first at the left edge and the second
116
+ * at the right edge. true: the two children share the width in equal halves.
117
+ */
118
+ equal?: string;
119
+ width?: string;
120
+ }
121
+ /**
122
+ * A row that wraps: children sit side by side, and continue on the next line when they run out of
123
+ * width. Splits across pages between lines.
124
+ */
125
+ export interface ClusterAttr {
126
+ font?: string;
127
+ fontSize?: string;
128
+ gap?: string;
129
+ /**
130
+ * Space between the edge of the box and its content, written like CSS: one value for all sides,
131
+ * two for top-bottom and left-right, three for top, left-right and bottom, four for top, right,
132
+ * bottom and left.
133
+ */
134
+ padding?: string;
135
+ /**
136
+ * Height of the box. Leave it out to size to the content. A length fixes it; fill takes what is
137
+ * left after its siblings (shared equally if several use fill); full takes all the height
138
+ * available. Any of these stops the box splitting across pages.
139
+ */
140
+ height?: string;
141
+ background?: string;
142
+ border?: string;
143
+ radius?: string;
144
+ /**
145
+ * Where the box falls in the page flow. no: never split the box, and move it whole to the next
146
+ * page when it does not fit. break-before: start it on a new page. break-after: start the next
147
+ * sibling on a new page. keep-next: keep it on one page with the sibling that follows, moving
148
+ * both to the next page if that sibling would not fit. break-before, break-after and keep-next
149
+ * take effect on the children of layout; on a box inside another box they are not applied. no
150
+ * applies at any depth.
151
+ */
152
+ paginate?: string;
153
+ debug?: string;
154
+ align?: string;
155
+ justify?: string;
156
+ width?: string;
157
+ }
158
+ /**
159
+ * Fills a fixed number of equal columns from left to right, then starts a new row. A row never
160
+ * splits across pages. For data with a header row, use table.
161
+ */
162
+ export interface GridAttr {
163
+ font?: string;
164
+ fontSize?: string;
165
+ gap?: string;
166
+ /**
167
+ * Space between the edge of the box and its content, written like CSS: one value for all sides,
168
+ * two for top-bottom and left-right, three for top, left-right and bottom, four for top, right,
169
+ * bottom and left.
170
+ */
171
+ padding?: string;
172
+ /**
173
+ * Height of the box. Leave it out to size to the content. A length fixes it; fill takes what is
174
+ * left after its siblings (shared equally if several use fill); full takes all the height
175
+ * available. Any of these stops the box splitting across pages.
176
+ */
177
+ height?: string;
178
+ background?: string;
179
+ border?: string;
180
+ radius?: string;
181
+ /**
182
+ * Where the box falls in the page flow. no: never split the box, and move it whole to the next
183
+ * page when it does not fit. break-before: start it on a new page. break-after: start the next
184
+ * sibling on a new page. keep-next: keep it on one page with the sibling that follows, moving
185
+ * both to the next page if that sibling would not fit. break-before, break-after and keep-next
186
+ * take effect on the children of layout; on a box inside another box they are not applied. no
187
+ * applies at any depth.
188
+ */
189
+ paginate?: string;
190
+ debug?: string;
191
+ width?: string;
192
+ colWidth?: string;
193
+ cols?: string;
194
+ }
195
+ /**
196
+ * A box around a single child, which it centres. Never splits across pages: if it does not fit, the
197
+ * whole box moves to the next page.
198
+ */
199
+ export interface FrameAttr {
200
+ font?: string;
201
+ fontSize?: string;
202
+ /**
203
+ * Space between the edge of the box and its content, written like CSS: one value for all sides,
204
+ * two for top-bottom and left-right, three for top, left-right and bottom, four for top, right,
205
+ * bottom and left.
206
+ */
207
+ padding?: string;
208
+ /**
209
+ * Height of the box. Leave it out to size to the content. A length fixes it; fill takes what is
210
+ * left after its siblings (shared equally if several use fill); full takes all the height
211
+ * available. Any of these stops the box splitting across pages.
212
+ */
213
+ height?: string;
214
+ background?: string;
215
+ border?: string;
216
+ radius?: string;
217
+ /**
218
+ * Where the box falls in the page flow. no: never split the box, and move it whole to the next
219
+ * page when it does not fit. break-before: start it on a new page. break-after: start the next
220
+ * sibling on a new page. keep-next: keep it on one page with the sibling that follows, moving
221
+ * both to the next page if that sibling would not fit. break-before, break-after and keep-next
222
+ * take effect on the children of layout; on a box inside another box they are not applied. no
223
+ * applies at any depth.
224
+ */
225
+ paginate?: string;
226
+ debug?: string;
227
+ width?: string;
228
+ }
229
+ /**
230
+ * Attributes of the `link` element.
231
+ */
232
+ export interface LinkAttr {
233
+ href: string;
234
+ gap?: string;
235
+ width?: string;
236
+ height?: string;
237
+ debug?: string;
238
+ }
239
+ /**
240
+ * Attributes of the `divider` element.
241
+ */
242
+ export interface DividerAttr {
243
+ direction?: string;
244
+ color?: string;
245
+ thickness?: string;
246
+ debug?: string;
247
+ }
248
+ /**
249
+ * Attributes of the `span` element.
250
+ */
251
+ export interface SpanAttr {
252
+ font?: string;
253
+ bold?: string;
254
+ color?: string;
255
+ href?: string;
256
+ underline?: string;
257
+ strike?: string;
258
+ }
259
+ /**
260
+ * Attributes of the `img` element.
261
+ */
262
+ export interface ImgAttr {
263
+ name: string;
264
+ height?: string;
265
+ width?: string;
266
+ font?: string;
267
+ fontSize?: string;
268
+ gap?: string;
269
+ padding?: string;
270
+ background?: string;
271
+ border?: string;
272
+ radius?: string;
273
+ paginate?: string;
274
+ debug?: string;
275
+ }
276
+ /**
277
+ * Attributes of the `barcode` element.
278
+ */
279
+ export interface BarcodeAttr {
280
+ type: string;
281
+ data: string;
282
+ size?: string;
283
+ width?: string;
284
+ height?: string;
285
+ ec?: string;
286
+ hrt?: string;
287
+ color?: string;
288
+ background?: string;
289
+ paginate?: string;
290
+ debug?: string;
291
+ }
292
+ /**
293
+ * A block of wrapping text. Use span children to style parts of it. Splits across pages between
294
+ * lines.
295
+ */
296
+ export interface TextAttr {
297
+ fontSize?: string;
298
+ font?: string;
299
+ /**
300
+ * Use the bold face of the font. It applies to the 14 built-in fonts: Helvetica becomes
301
+ * Helvetica-Bold, Times-Roman becomes Times-Bold, Courier becomes Courier-Bold, and the oblique
302
+ * and italic faces their bold forms. A custom font has no bold face to pick, so name one in font.
303
+ */
304
+ bold?: string;
305
+ color?: string;
306
+ align?: string;
307
+ width?: string;
308
+ paginate?: string;
309
+ debug?: string;
310
+ }
311
+ /**
312
+ * Attributes of the `td` element.
313
+ */
314
+ export interface TdAttr {
315
+ font?: string;
316
+ fontSize?: string;
317
+ gap?: string;
318
+ /**
319
+ * Space between the edge of the box and its content, written like CSS: one value for all sides,
320
+ * two for top-bottom and left-right, three for top, left-right and bottom, four for top, right,
321
+ * bottom and left.
322
+ */
323
+ padding?: string;
324
+ /**
325
+ * Height of the box. Leave it out to size to the content. A length fixes it; fill takes what is
326
+ * left after its siblings (shared equally if several use fill); full takes all the height
327
+ * available. Any of these stops the box splitting across pages.
328
+ */
329
+ height?: string;
330
+ background?: string;
331
+ border?: string;
332
+ radius?: string;
333
+ /**
334
+ * Where the box falls in the page flow. no: never split the box, and move it whole to the next
335
+ * page when it does not fit. break-before: start it on a new page. break-after: start the next
336
+ * sibling on a new page. keep-next: keep it on one page with the sibling that follows, moving
337
+ * both to the next page if that sibling would not fit. break-before, break-after and keep-next
338
+ * take effect on the children of layout; on a box inside another box they are not applied. no
339
+ * applies at any depth.
340
+ */
341
+ paginate?: string;
342
+ debug?: string;
343
+ align?: string;
344
+ valign?: string;
345
+ }
346
+ /**
347
+ * Attributes of the `thead` element.
348
+ */
349
+ export interface TheadAttr {
350
+ background?: string;
351
+ }
352
+ /**
353
+ * Attributes of the `tr` element.
354
+ */
355
+ export interface TrAttr {
356
+ background?: string;
357
+ }
358
+ /**
359
+ * Rows and cells in columns whose widths are set by cols. The thead row repeats at the top of every
360
+ * page, and rows move between pages whole.
361
+ */
362
+ export interface TableAttr {
363
+ /**
364
+ * Column widths, separated by spaces, in fr, pt or % units: for example 2fr 1fr 120pt 20%.
365
+ */
366
+ cols: string;
367
+ border?: string;
368
+ stripe?: string;
369
+ gap?: string;
370
+ padding?: string;
371
+ background?: string;
372
+ width?: string;
373
+ height?: string;
374
+ paginate?: string;
375
+ debug?: string;
376
+ }
377
+ /**
378
+ * Attributes of the `field` element.
379
+ */
380
+ export interface FieldAttr {
381
+ type: string;
382
+ name: string;
383
+ value?: string;
384
+ label?: string;
385
+ options?: string;
386
+ group?: string;
387
+ checked?: string;
388
+ required?: string;
389
+ readonly?: string;
390
+ maxLen?: string;
391
+ actionUrl?: string;
392
+ width?: string;
393
+ height?: string;
394
+ background?: string;
395
+ border?: string;
396
+ debug?: string;
397
+ }
398
+ /**
399
+ * Pins content to the top or bottom edge of pages, outside the normal flow, for headers and
400
+ * footers. It reserves that space on every page it appears on. Only allowed directly inside layout,
401
+ * and one per pin on a page.
402
+ */
403
+ export interface RegionAttr {
404
+ /**
405
+ * Which edge the region sticks to. top and bottom work. left and right pass validation but are
406
+ * not implemented yet.
407
+ */
408
+ pin: string;
409
+ /**
410
+ * Which pages show the region: each, first, last, odd, even, or a range such as 2-last. Defaults
411
+ * to each.
412
+ */
413
+ page?: string;
414
+ w?: string;
415
+ debug?: string;
416
+ }
417
+ /**
418
+ * Groups canvas shapes and sets what applies to all of them: which pages they appear on, opacity,
419
+ * transform and clip. Layers cannot be nested.
420
+ */
421
+ export interface LayerAttr {
422
+ page?: string;
423
+ opacity?: string;
424
+ transform?: string;
425
+ clip?: string;
426
+ }
427
+ /**
428
+ * Attributes of the `rect` element on the canvas.
429
+ */
430
+ export interface RectAttr {
431
+ w: string;
432
+ h: string;
433
+ x?: string;
434
+ y?: string;
435
+ anchor?: string;
436
+ radius?: string;
437
+ fill?: string;
438
+ stroke?: string;
439
+ strokeWidth?: string;
440
+ strokeDash?: string;
441
+ opacity?: string;
442
+ }
443
+ /**
444
+ * Attributes of the `circle` element on the canvas.
445
+ */
446
+ export interface CircleAttr {
447
+ r: string;
448
+ cx?: string;
449
+ cy?: string;
450
+ anchor?: string;
451
+ fill?: string;
452
+ stroke?: string;
453
+ strokeWidth?: string;
454
+ strokeDash?: string;
455
+ opacity?: string;
456
+ }
457
+ /**
458
+ * Attributes of the `ellipse` element on the canvas.
459
+ */
460
+ export interface EllipseAttr {
461
+ rx: string;
462
+ ry: string;
463
+ cx?: string;
464
+ cy?: string;
465
+ anchor?: string;
466
+ fill?: string;
467
+ stroke?: string;
468
+ strokeWidth?: string;
469
+ strokeDash?: string;
470
+ opacity?: string;
471
+ }
472
+ /**
473
+ * Attributes of the `line` element on the canvas.
474
+ */
475
+ export interface LineAttr {
476
+ x1: string;
477
+ y1: string;
478
+ x2: string;
479
+ y2: string;
480
+ stroke?: string;
481
+ strokeWidth?: string;
482
+ strokeDash?: string;
483
+ lineCap?: string;
484
+ }
485
+ /**
486
+ * Attributes of the `path` element on the canvas.
487
+ */
488
+ export interface PathAttr {
489
+ d: string;
490
+ fill?: string;
491
+ stroke?: string;
492
+ fillRule?: string;
493
+ strokeWidth?: string;
494
+ strokeDash?: string;
495
+ lineCap?: string;
496
+ opacity?: string;
497
+ }
498
+ /**
499
+ * Text at an exact position on the page: either x and y, or an anchor with optional offsets.
500
+ */
501
+ export interface CanvasTextAttr {
502
+ x?: string;
503
+ y?: string;
504
+ anchor?: string;
505
+ font?: string;
506
+ fontSize?: string;
507
+ color?: string;
508
+ align?: string;
509
+ w?: string;
510
+ lineHeight?: string;
511
+ opacity?: string;
512
+ }
513
+ /**
514
+ * Attributes of the `img` element on the canvas.
515
+ */
516
+ export interface CanvasImgAttr {
517
+ name: string;
518
+ w: string;
519
+ h: string;
520
+ x?: string;
521
+ y?: string;
522
+ anchor?: string;
523
+ }
524
+ /**
525
+ * Declares a font that text can be set in by name, with the font attribute. A built-in PDF font is
526
+ * named by core; any other font is a file the SDK reads from src, or one loaded on the engine under
527
+ * ref or, with no ref, under the font's own name.
528
+ */
529
+ export interface FontAttr {
530
+ /**
531
+ * The name that the font attribute of a text uses to pick this font: lowercase letters, digits
532
+ * and -, starting with a letter.
533
+ */
534
+ name: string;
535
+ /** A built-in PDF font, which needs no file. */
536
+ core?: string;
537
+ /** The key the font was loaded under on the engine, when that is not its name. */
538
+ ref?: string;
539
+ /**
540
+ * A path the SDK reads the font file from, when the font was not loaded on the engine.
541
+ */
542
+ src?: string;
543
+ }
544
+ /**
545
+ * Declares an image that an img refers to by name. The SDK reads the file from src, or the image
546
+ * was loaded on the engine under ref or, with no ref, under its own name.
547
+ */
548
+ export interface ImageAttr {
549
+ /**
550
+ * The name that the name attribute of an img uses to pick this image: lowercase letters, digits
551
+ * and -, starting with a letter.
552
+ */
553
+ name: string;
554
+ /** The key the image was loaded under on the engine, when that is not its name. */
555
+ ref?: string;
556
+ /**
557
+ * A path the SDK reads the image file from, when the image was not loaded on the engine.
558
+ */
559
+ src?: string;
560
+ }
package/dist/attrs.js ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // Generated from lpdf.xsd by scripts/gen-sdk-api.mjs.
3
+ // Do not edit: change the schema and run `make gen-sdk-api`.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
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
  };