@lpdfio/lpdf 0.23.0 → 0.25.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/dist/L.d.ts +2 -1
- package/dist/L.js +1 -0
- package/dist/attrs.d.ts +109 -0
- package/dist/browser.js +4 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.js +5 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -1
- package/dist/kit.d.ts +5 -3
- package/dist/layout.d.ts +13 -2
- package/dist/layout.js +8 -0
- package/dist/wasm/lpdf_bg.wasm +0 -0
- package/package.json +1 -1
package/dist/L.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export declare const L: Readonly<{
|
|
|
30
30
|
/** Convert a `PdfDocument` tree to an lpdf XML string. */
|
|
31
31
|
toXml: (doc: PdfDocument) => string;
|
|
32
32
|
document: (attrs: import("./kit").DocumentAttr | null, nodes?: import("./kit").LpdfSectionNode[]) => PdfDocument;
|
|
33
|
-
section: (attrs: import("./kit").SectionAttr | null, nodes?: (import("./kit").LpdfLayoutBlock | import("./kit").LpdfCanvasBlock)[]) => import("./kit").LpdfSectionNode;
|
|
33
|
+
section: (attrs: import("./kit").SectionAttr | null, nodes?: (import("./layout").LpdfBookmarkNode | import("./kit").LpdfLayoutBlock | import("./kit").LpdfCanvasBlock)[]) => import("./kit").LpdfSectionNode;
|
|
34
34
|
layout: (_attrs: null, nodes?: import("./layout").LpdfNode[]) => import("./kit").LpdfLayoutBlock;
|
|
35
35
|
canvas: (_attrs: null, layers?: import("./canvas").LpdfCanvasLayerNode[]) => import("./kit").LpdfCanvasBlock;
|
|
36
36
|
assets: (attrs: DocumentAssets) => DocumentAssets;
|
|
@@ -53,6 +53,7 @@ export declare const L: Readonly<{
|
|
|
53
53
|
barcode: (attrs: import("./attrs").BarcodeAttr) => import("./layout").LpdfBarcodeNode;
|
|
54
54
|
region: (attrs: import("./attrs").RegionAttr, nodes?: import("./layout").LpdfNode[]) => import("./layout").LpdfRegionNode;
|
|
55
55
|
field: (attrs: import("./attrs").FieldAttr) => import("./layout").LpdfFieldNode;
|
|
56
|
+
bookmark: (attrs: import("./attrs").BookmarkAttr) => import("./layout").LpdfBookmarkNode;
|
|
56
57
|
layer: (attrs: import("./attrs").LayerAttr | null, nodes?: import("./canvas").LpdfCanvasPrimitiveNode[]) => import("./canvas").LpdfCanvasLayerNode;
|
|
57
58
|
rect: (attrs: import("./attrs").RectAttr) => import("./canvas").LpdfCanvasRectNode;
|
|
58
59
|
line: (attrs: import("./attrs").LineAttr) => import("./canvas").LpdfCanvasLineNode;
|
package/dist/L.js
CHANGED
|
@@ -61,6 +61,7 @@ exports.L = Object.freeze({
|
|
|
61
61
|
barcode: layout_1.LpdfLayout.barcode,
|
|
62
62
|
region: layout_1.LpdfLayout.region,
|
|
63
63
|
field: layout_1.LpdfLayout.field,
|
|
64
|
+
bookmark: layout_1.LpdfLayout.bookmark,
|
|
64
65
|
// ── Canvas ────────────────────────────────────────────────────────────────
|
|
65
66
|
layer: canvas_1.LpdfCanvas.layer,
|
|
66
67
|
rect: canvas_1.LpdfCanvas.rect,
|
package/dist/attrs.d.ts
CHANGED
|
@@ -21,6 +21,15 @@ export interface StackAttr {
|
|
|
21
21
|
background?: string;
|
|
22
22
|
border?: string;
|
|
23
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;
|
|
24
33
|
debug?: string;
|
|
25
34
|
align?: string;
|
|
26
35
|
justify?: string;
|
|
@@ -49,6 +58,15 @@ export interface FlankAttr {
|
|
|
49
58
|
background?: string;
|
|
50
59
|
border?: string;
|
|
51
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;
|
|
52
70
|
debug?: string;
|
|
53
71
|
align?: string;
|
|
54
72
|
/**
|
|
@@ -82,6 +100,15 @@ export interface SplitAttr {
|
|
|
82
100
|
background?: string;
|
|
83
101
|
border?: string;
|
|
84
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;
|
|
85
112
|
debug?: string;
|
|
86
113
|
align?: string;
|
|
87
114
|
/**
|
|
@@ -114,6 +141,15 @@ export interface ClusterAttr {
|
|
|
114
141
|
background?: string;
|
|
115
142
|
border?: string;
|
|
116
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;
|
|
117
153
|
debug?: string;
|
|
118
154
|
align?: string;
|
|
119
155
|
justify?: string;
|
|
@@ -142,6 +178,15 @@ export interface GridAttr {
|
|
|
142
178
|
background?: string;
|
|
143
179
|
border?: string;
|
|
144
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;
|
|
145
190
|
debug?: string;
|
|
146
191
|
width?: string;
|
|
147
192
|
colWidth?: string;
|
|
@@ -169,6 +214,15 @@ export interface FrameAttr {
|
|
|
169
214
|
background?: string;
|
|
170
215
|
border?: string;
|
|
171
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;
|
|
172
226
|
debug?: string;
|
|
173
227
|
width?: string;
|
|
174
228
|
}
|
|
@@ -176,6 +230,10 @@ export interface FrameAttr {
|
|
|
176
230
|
* Attributes of the `link` element.
|
|
177
231
|
*/
|
|
178
232
|
export interface LinkAttr {
|
|
233
|
+
/**
|
|
234
|
+
* Where the link goes: a URL, or #id to jump to the bookmark with that id. In an entry of a table
|
|
235
|
+
* of contents, # alone jumps to that entry's bookmark.
|
|
236
|
+
*/
|
|
179
237
|
href: string;
|
|
180
238
|
gap?: string;
|
|
181
239
|
width?: string;
|
|
@@ -198,6 +256,10 @@ export interface SpanAttr {
|
|
|
198
256
|
font?: string;
|
|
199
257
|
bold?: string;
|
|
200
258
|
color?: string;
|
|
259
|
+
/**
|
|
260
|
+
* Makes the span a link: a URL, or #id to jump to the bookmark with that id. In an entry of a
|
|
261
|
+
* table of contents, # alone jumps to that entry's bookmark.
|
|
262
|
+
*/
|
|
201
263
|
href?: string;
|
|
202
264
|
underline?: string;
|
|
203
265
|
strike?: string;
|
|
@@ -216,6 +278,7 @@ export interface ImgAttr {
|
|
|
216
278
|
background?: string;
|
|
217
279
|
border?: string;
|
|
218
280
|
radius?: string;
|
|
281
|
+
paginate?: string;
|
|
219
282
|
debug?: string;
|
|
220
283
|
}
|
|
221
284
|
/**
|
|
@@ -231,6 +294,7 @@ export interface BarcodeAttr {
|
|
|
231
294
|
hrt?: string;
|
|
232
295
|
color?: string;
|
|
233
296
|
background?: string;
|
|
297
|
+
paginate?: string;
|
|
234
298
|
debug?: string;
|
|
235
299
|
}
|
|
236
300
|
/**
|
|
@@ -249,6 +313,20 @@ export interface TextAttr {
|
|
|
249
313
|
color?: string;
|
|
250
314
|
align?: string;
|
|
251
315
|
width?: string;
|
|
316
|
+
/**
|
|
317
|
+
* The fewest lines of the text that may stand alone at the top of the next page when it splits.
|
|
318
|
+
* Default 2. If fewer would be left, lines move from the first page to the next; 1 turns the
|
|
319
|
+
* protection off.
|
|
320
|
+
*/
|
|
321
|
+
widows?: string;
|
|
322
|
+
/**
|
|
323
|
+
* The fewest lines of the text that may stand alone at the bottom of a page when it splits.
|
|
324
|
+
* Default 2. If fewer would fit, the whole text moves to the next page; 1 turns the protection
|
|
325
|
+
* off. When no split can keep both widows and orphans, even on an empty page, the text splits
|
|
326
|
+
* where the lines fit.
|
|
327
|
+
*/
|
|
328
|
+
orphans?: string;
|
|
329
|
+
paginate?: string;
|
|
252
330
|
debug?: string;
|
|
253
331
|
}
|
|
254
332
|
/**
|
|
@@ -273,6 +351,15 @@ export interface TdAttr {
|
|
|
273
351
|
background?: string;
|
|
274
352
|
border?: string;
|
|
275
353
|
radius?: string;
|
|
354
|
+
/**
|
|
355
|
+
* Where the box falls in the page flow. no: never split the box, and move it whole to the next
|
|
356
|
+
* page when it does not fit. break-before: start it on a new page. break-after: start the next
|
|
357
|
+
* sibling on a new page. keep-next: keep it on one page with the sibling that follows, moving
|
|
358
|
+
* both to the next page if that sibling would not fit. break-before, break-after and keep-next
|
|
359
|
+
* take effect on the children of layout; on a box inside another box they are not applied. no
|
|
360
|
+
* applies at any depth.
|
|
361
|
+
*/
|
|
362
|
+
paginate?: string;
|
|
276
363
|
debug?: string;
|
|
277
364
|
align?: string;
|
|
278
365
|
valign?: string;
|
|
@@ -305,6 +392,7 @@ export interface TableAttr {
|
|
|
305
392
|
background?: string;
|
|
306
393
|
width?: string;
|
|
307
394
|
height?: string;
|
|
395
|
+
paginate?: string;
|
|
308
396
|
debug?: string;
|
|
309
397
|
}
|
|
310
398
|
/**
|
|
@@ -328,6 +416,27 @@ export interface FieldAttr {
|
|
|
328
416
|
border?: string;
|
|
329
417
|
debug?: string;
|
|
330
418
|
}
|
|
419
|
+
/**
|
|
420
|
+
* An entry of the PDF's outline, the bookmark panel of a viewer, and a target for links with
|
|
421
|
+
* href="#id". It draws nothing and marks the element that follows it, so it is never left at the
|
|
422
|
+
* bottom of a page apart from that element. Directly inside a section, it marks the section's first
|
|
423
|
+
* page.
|
|
424
|
+
*/
|
|
425
|
+
export interface BookmarkAttr {
|
|
426
|
+
/** The text of the entry, in the outline and in a table of contents. */
|
|
427
|
+
label: string;
|
|
428
|
+
/**
|
|
429
|
+
* Depth in the outline, 1 to 6. Defaults to 1. An entry nests under the closest entry before it
|
|
430
|
+
* with a lower level.
|
|
431
|
+
*/
|
|
432
|
+
level?: string;
|
|
433
|
+
/**
|
|
434
|
+
* The name links use to jump here, as href="#id". Leave it out to make it from the label:
|
|
435
|
+
* lowercase, with other characters than letters and digits turned into hyphens, and -2, -3 added
|
|
436
|
+
* when an earlier bookmark has it. Two bookmarks may not have the same id.
|
|
437
|
+
*/
|
|
438
|
+
id?: string;
|
|
439
|
+
}
|
|
331
440
|
/**
|
|
332
441
|
* Pins content to the top or bottom edge of pages, outside the normal flow, for headers and
|
|
333
442
|
* footers. It reserves that space on every page it appears on. Only allowed directly inside layout,
|
package/dist/browser.js
CHANGED
|
@@ -410,6 +410,9 @@ var Orientation = {
|
|
|
410
410
|
Portrait: "portrait",
|
|
411
411
|
Landscape: "landscape"
|
|
412
412
|
};
|
|
413
|
+
var SectionType = {
|
|
414
|
+
Toc: "toc"
|
|
415
|
+
};
|
|
413
416
|
var BuiltinFont = {
|
|
414
417
|
Courier: "Courier",
|
|
415
418
|
CourierBold: "Courier-Bold",
|
|
@@ -491,5 +494,6 @@ export {
|
|
|
491
494
|
Orientation,
|
|
492
495
|
PageScope,
|
|
493
496
|
Pin,
|
|
497
|
+
SectionType,
|
|
494
498
|
initLpdf
|
|
495
499
|
};
|
package/dist/constants.d.ts
CHANGED
|
@@ -21,6 +21,11 @@ export declare const Orientation: {
|
|
|
21
21
|
readonly Landscape: "landscape";
|
|
22
22
|
};
|
|
23
23
|
export type Orientation = (typeof Orientation)[keyof typeof Orientation];
|
|
24
|
+
/** The values of the `type` attribute of a section. */
|
|
25
|
+
export declare const SectionType: {
|
|
26
|
+
readonly Toc: "toc";
|
|
27
|
+
};
|
|
28
|
+
export type SectionType = (typeof SectionType)[keyof typeof SectionType];
|
|
24
29
|
/** The values of the `core` attribute of a font: the built-in PDF fonts, which need no file. */
|
|
25
30
|
export declare const BuiltinFont: {
|
|
26
31
|
readonly Courier: "Courier";
|
package/dist/constants.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Generated from lpdf.xsd by scripts/gen-sdk-api.mjs.
|
|
3
3
|
// Do not edit: change the schema and run `make gen-sdk-api`.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.PageScope = exports.BuiltinFont = exports.Orientation = exports.Pin = exports.FieldType = void 0;
|
|
5
|
+
exports.PageScope = exports.BuiltinFont = exports.SectionType = exports.Orientation = exports.Pin = exports.FieldType = void 0;
|
|
6
6
|
/** The values of the `type` attribute of a field. */
|
|
7
7
|
exports.FieldType = {
|
|
8
8
|
Text: 'text',
|
|
@@ -23,6 +23,10 @@ exports.Orientation = {
|
|
|
23
23
|
Portrait: 'portrait',
|
|
24
24
|
Landscape: 'landscape',
|
|
25
25
|
};
|
|
26
|
+
/** The values of the `type` attribute of a section. */
|
|
27
|
+
exports.SectionType = {
|
|
28
|
+
Toc: 'toc',
|
|
29
|
+
};
|
|
26
30
|
/** The values of the `core` attribute of a font: the built-in PDF fonts, which need no file. */
|
|
27
31
|
exports.BuiltinFont = {
|
|
28
32
|
Courier: 'Courier',
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { PdfEngine, LpdfRenderError } from './engine';
|
|
2
2
|
export type { EncryptPermissions, EncryptOptions } from './engine';
|
|
3
3
|
export type { RenderOptions, EngineOptions } from './_shared';
|
|
4
|
-
export { FieldType, Pin, Orientation, BuiltinFont, PageScope } from './constants';
|
|
4
|
+
export { FieldType, Pin, Orientation, SectionType, BuiltinFont, PageScope } from './constants';
|
|
5
5
|
export type { PdfDocument, LpdfSectionNode, LpdfLayoutBlock, LpdfCanvasBlock, DocumentTokens, DocumentAssets, DocumentMeta, SectionAttr, DocumentAttr, } from './kit';
|
|
6
|
-
export type { StackAttr, FlankAttr, SplitAttr, ClusterAttr, GridAttr, FrameAttr, LinkAttr, TableAttr, TheadAttr, TrAttr, TdAttr, TextAttr, SpanAttr, DividerAttr, ImgAttr, BarcodeAttr, RegionAttr, FieldAttr, LayerAttr, RectAttr, CircleAttr, EllipseAttr, LineAttr, PathAttr, CanvasTextAttr, CanvasImgAttr, FontAttr, ImageAttr, } from './attrs';
|
|
7
|
-
export type { LpdfNode, LpdfContainerNode, LpdfTextNode, LpdfSpanNode, LpdfDividerNode, LpdfImgNode, LpdfBarcodeNode, LpdfTableNode, LpdfTheadNode, LpdfTrNode, LpdfTdNode, LpdfRegionNode, LpdfFieldNode, } from './layout';
|
|
6
|
+
export type { StackAttr, FlankAttr, SplitAttr, ClusterAttr, GridAttr, FrameAttr, LinkAttr, TableAttr, TheadAttr, TrAttr, TdAttr, TextAttr, SpanAttr, DividerAttr, ImgAttr, BarcodeAttr, RegionAttr, FieldAttr, BookmarkAttr, LayerAttr, RectAttr, CircleAttr, EllipseAttr, LineAttr, PathAttr, CanvasTextAttr, CanvasImgAttr, FontAttr, ImageAttr, } from './attrs';
|
|
7
|
+
export type { LpdfNode, LpdfContainerNode, LpdfTextNode, LpdfSpanNode, LpdfDividerNode, LpdfImgNode, LpdfBarcodeNode, LpdfTableNode, LpdfTheadNode, LpdfTrNode, LpdfTdNode, LpdfRegionNode, LpdfFieldNode, LpdfBookmarkNode, } from './layout';
|
|
8
8
|
export { CanvasTransform } from './canvas';
|
|
9
9
|
export type { LpdfCanvasLayerNode, LpdfCanvasPrimitiveNode, LpdfCanvasRectNode, LpdfCanvasLineNode, LpdfCanvasEllipseNode, LpdfCanvasCircleNode, LpdfCanvasPathNode, LpdfCanvasTextNode, LpdfCanvasImgNode, } from './canvas';
|
|
10
10
|
export { L, NoAttr } from './L';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NoAttr = exports.L = exports.CanvasTransform = exports.PageScope = exports.BuiltinFont = exports.Orientation = exports.Pin = exports.FieldType = exports.LpdfRenderError = exports.PdfEngine = void 0;
|
|
3
|
+
exports.NoAttr = exports.L = exports.CanvasTransform = exports.PageScope = exports.BuiltinFont = exports.SectionType = exports.Orientation = exports.Pin = exports.FieldType = exports.LpdfRenderError = exports.PdfEngine = void 0;
|
|
4
4
|
// ── Engine ────────────────────────────────────────────────────────────────────
|
|
5
5
|
var engine_1 = require("./engine");
|
|
6
6
|
Object.defineProperty(exports, "PdfEngine", { enumerable: true, get: function () { return engine_1.PdfEngine; } });
|
|
@@ -10,6 +10,7 @@ var constants_1 = require("./constants");
|
|
|
10
10
|
Object.defineProperty(exports, "FieldType", { enumerable: true, get: function () { return constants_1.FieldType; } });
|
|
11
11
|
Object.defineProperty(exports, "Pin", { enumerable: true, get: function () { return constants_1.Pin; } });
|
|
12
12
|
Object.defineProperty(exports, "Orientation", { enumerable: true, get: function () { return constants_1.Orientation; } });
|
|
13
|
+
Object.defineProperty(exports, "SectionType", { enumerable: true, get: function () { return constants_1.SectionType; } });
|
|
13
14
|
Object.defineProperty(exports, "BuiltinFont", { enumerable: true, get: function () { return constants_1.BuiltinFont; } });
|
|
14
15
|
Object.defineProperty(exports, "PageScope", { enumerable: true, get: function () { return constants_1.PageScope; } });
|
|
15
16
|
// ── Canvas types ──────────────────────────────────────────────────────────────
|
package/dist/kit.d.ts
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* const bytes = await new LpdfEngine(key).renderPdf(doc);
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
import type { LpdfNode } from './layout';
|
|
26
|
+
import type { LpdfBookmarkNode, LpdfNode } from './layout';
|
|
27
27
|
import type { LpdfCanvasLayerNode } from './canvas';
|
|
28
28
|
import type { FontAttr, ImageAttr } from './attrs';
|
|
29
29
|
export interface DocumentTokens {
|
|
@@ -57,6 +57,8 @@ export interface SectionAttr {
|
|
|
57
57
|
background?: string;
|
|
58
58
|
title?: string;
|
|
59
59
|
debug?: string;
|
|
60
|
+
type?: string;
|
|
61
|
+
tocIndentStep?: string;
|
|
60
62
|
}
|
|
61
63
|
export interface DocumentAttr {
|
|
62
64
|
size?: string;
|
|
@@ -82,7 +84,7 @@ export interface LpdfCanvasBlock {
|
|
|
82
84
|
export interface LpdfSectionNode {
|
|
83
85
|
type: 'section';
|
|
84
86
|
attrs: Record<string, string>;
|
|
85
|
-
nodes: (LpdfLayoutBlock | LpdfCanvasBlock)[];
|
|
87
|
+
nodes: (LpdfBookmarkNode | LpdfLayoutBlock | LpdfCanvasBlock)[];
|
|
86
88
|
}
|
|
87
89
|
export interface PdfDocument {
|
|
88
90
|
version: 1;
|
|
@@ -92,7 +94,7 @@ export interface PdfDocument {
|
|
|
92
94
|
}
|
|
93
95
|
declare function layout(_attrs: null, nodes?: LpdfNode[]): LpdfLayoutBlock;
|
|
94
96
|
declare function canvas(_attrs: null, layers?: LpdfCanvasLayerNode[]): LpdfCanvasBlock;
|
|
95
|
-
declare function section(attrs: SectionAttr | null, nodes?: (LpdfLayoutBlock | LpdfCanvasBlock)[]): LpdfSectionNode;
|
|
97
|
+
declare function section(attrs: SectionAttr | null, nodes?: (LpdfBookmarkNode | LpdfLayoutBlock | LpdfCanvasBlock)[]): LpdfSectionNode;
|
|
96
98
|
declare function document(attrs: DocumentAttr | null, nodes?: LpdfSectionNode[]): PdfDocument;
|
|
97
99
|
export declare const LpdfKit: Readonly<{
|
|
98
100
|
layout: typeof layout;
|
package/dist/layout.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StackAttr, FlankAttr, SplitAttr, ClusterAttr, GridAttr, FrameAttr, LinkAttr, TableAttr, TheadAttr, TrAttr, TdAttr, TextAttr, SpanAttr, DividerAttr, ImgAttr, BarcodeAttr, FieldAttr, RegionAttr } from './attrs';
|
|
1
|
+
import type { StackAttr, FlankAttr, SplitAttr, ClusterAttr, GridAttr, FrameAttr, LinkAttr, TableAttr, TheadAttr, TrAttr, TdAttr, TextAttr, SpanAttr, DividerAttr, ImgAttr, BarcodeAttr, FieldAttr, RegionAttr, BookmarkAttr } from './attrs';
|
|
2
2
|
export interface LpdfSpanNode {
|
|
3
3
|
type: 'span';
|
|
4
4
|
attrs: Record<string, string>;
|
|
@@ -55,7 +55,12 @@ export interface LpdfFieldNode {
|
|
|
55
55
|
type: 'field';
|
|
56
56
|
attrs: Record<string, string>;
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
/** An outline entry and link target that marks the node after it; it draws nothing. */
|
|
59
|
+
export interface LpdfBookmarkNode {
|
|
60
|
+
type: 'bookmark';
|
|
61
|
+
attrs: Record<string, string>;
|
|
62
|
+
}
|
|
63
|
+
export type LpdfNode = LpdfContainerNode | LpdfTextNode | LpdfDividerNode | LpdfTableNode | LpdfImgNode | LpdfBarcodeNode | LpdfRegionNode | LpdfFieldNode | LpdfBookmarkNode;
|
|
59
64
|
declare function stack(attrs: StackAttr | null, nodes?: LpdfNode[]): LpdfContainerNode;
|
|
60
65
|
declare function flank(attrs: FlankAttr | null, nodes?: LpdfNode[]): LpdfContainerNode;
|
|
61
66
|
declare function split(attrs: SplitAttr | null, nodes?: LpdfNode[]): LpdfContainerNode;
|
|
@@ -74,6 +79,11 @@ declare function img(attrs: ImgAttr): LpdfImgNode;
|
|
|
74
79
|
declare function barcode(attrs: BarcodeAttr): LpdfBarcodeNode;
|
|
75
80
|
declare function region(attrs: RegionAttr, nodes?: LpdfNode[]): LpdfRegionNode;
|
|
76
81
|
declare function field(attrs: FieldAttr): LpdfFieldNode;
|
|
82
|
+
/**
|
|
83
|
+
* An entry of the PDF's outline and a target for `href: '#id'` links. It marks the node that follows it
|
|
84
|
+
* in the same list; directly in a section's nodes, it marks the section's first page.
|
|
85
|
+
*/
|
|
86
|
+
declare function bookmark(attrs: BookmarkAttr): LpdfBookmarkNode;
|
|
77
87
|
export declare const LpdfLayout: Readonly<{
|
|
78
88
|
stack: typeof stack;
|
|
79
89
|
flank: typeof flank;
|
|
@@ -93,5 +103,6 @@ export declare const LpdfLayout: Readonly<{
|
|
|
93
103
|
td: typeof td;
|
|
94
104
|
region: typeof region;
|
|
95
105
|
field: typeof field;
|
|
106
|
+
bookmark: typeof bookmark;
|
|
96
107
|
}>;
|
|
97
108
|
export {};
|
package/dist/layout.js
CHANGED
|
@@ -61,6 +61,13 @@ function region(attrs, nodes = []) {
|
|
|
61
61
|
function field(attrs) {
|
|
62
62
|
return { type: 'field', attrs: (0, _shared_1.buildAttrs)(attrs) };
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* An entry of the PDF's outline and a target for `href: '#id'` links. It marks the node that follows it
|
|
66
|
+
* in the same list; directly in a section's nodes, it marks the section's first page.
|
|
67
|
+
*/
|
|
68
|
+
function bookmark(attrs) {
|
|
69
|
+
return { type: 'bookmark', attrs: (0, _shared_1.buildAttrs)(attrs) };
|
|
70
|
+
}
|
|
64
71
|
exports.LpdfLayout = Object.freeze({
|
|
65
72
|
stack,
|
|
66
73
|
flank,
|
|
@@ -80,4 +87,5 @@ exports.LpdfLayout = Object.freeze({
|
|
|
80
87
|
td,
|
|
81
88
|
region,
|
|
82
89
|
field,
|
|
90
|
+
bookmark,
|
|
83
91
|
});
|
package/dist/wasm/lpdf_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lpdfio/lpdf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "Node.js SDK for Lpdf — PDF as Code on every platform. You describe a document as code or XML. Lpdf renders a compact, pixel-perfect PDF — identical across platforms.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|