@lpdfio/lpdf 0.5.0 → 0.7.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 +33 -16
- package/README.md +33 -38
- package/dist/_shared.d.ts +3 -6
- package/dist/browser.js +21 -62
- package/dist/canvas.d.ts +8 -6
- package/dist/canvas.js +13 -13
- package/dist/engine.d.ts +16 -13
- package/dist/engine.js +23 -23
- package/dist/index.d.ts +9 -45
- package/dist/index.js +12 -32
- package/dist/kit-to-xml.d.ts +2 -2
- package/dist/kit.d.ts +7 -16
- package/dist/kit.js +12 -12
- package/dist/layout.d.ts +35 -34
- package/dist/layout.js +43 -43
- package/dist/pdf.d.ts +61 -0
- package/dist/pdf.js +70 -0
- package/package.json +2 -2
package/dist/pdf.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.L = exports.NoAttr = void 0;
|
|
4
|
+
const kit_1 = require("./kit");
|
|
5
|
+
const layout_1 = require("./layout");
|
|
6
|
+
const canvas_1 = require("./canvas");
|
|
7
|
+
const engine_1 = require("./engine");
|
|
8
|
+
const kit_to_xml_1 = require("./kit-to-xml");
|
|
9
|
+
/** Pass as `attrs` when a node has no attributes. Equivalent to `null`. */
|
|
10
|
+
exports.NoAttr = null;
|
|
11
|
+
/**
|
|
12
|
+
* Unified lpdf facade.
|
|
13
|
+
*
|
|
14
|
+
* All document, layout, and canvas factory methods are available as flat
|
|
15
|
+
* properties on this object. Construction-time configuration is handled via
|
|
16
|
+
* `L.engine()`.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { L, NoAttr } from 'lpdf';
|
|
21
|
+
*
|
|
22
|
+
* const engine = L.engine().setLicenseKey(process.env.LPDF_KEY);
|
|
23
|
+
*
|
|
24
|
+
* const doc = L.document(NoAttr, [
|
|
25
|
+
* L.section(NoAttr, [
|
|
26
|
+
* L.layout(null, [ L.text(NoAttr, ['Hello']) ]),
|
|
27
|
+
* ]),
|
|
28
|
+
* ]);
|
|
29
|
+
*
|
|
30
|
+
* const pdf = await engine.render(doc);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
exports.L = Object.freeze({
|
|
34
|
+
/** Create a new {@link PdfEngine} instance. Call `.setLicenseKey()` to configure. */
|
|
35
|
+
engine: () => new engine_1.PdfEngine(),
|
|
36
|
+
/** Convert a `PdfDocument` tree to an lpdf XML string. */
|
|
37
|
+
toXml: (doc) => (0, kit_to_xml_1.kitToXml)(doc),
|
|
38
|
+
// ── Kit ───────────────────────────────────────────────────────────────────
|
|
39
|
+
document: kit_1.LpdfKit.document,
|
|
40
|
+
section: kit_1.LpdfKit.section,
|
|
41
|
+
layout: kit_1.LpdfKit.layout,
|
|
42
|
+
canvas: kit_1.LpdfKit.canvas,
|
|
43
|
+
// ── Layout ────────────────────────────────────────────────────────────────
|
|
44
|
+
stack: layout_1.LpdfLayout.stack,
|
|
45
|
+
flank: layout_1.LpdfLayout.flank,
|
|
46
|
+
split: layout_1.LpdfLayout.split,
|
|
47
|
+
cluster: layout_1.LpdfLayout.cluster,
|
|
48
|
+
grid: layout_1.LpdfLayout.grid,
|
|
49
|
+
frame: layout_1.LpdfLayout.frame,
|
|
50
|
+
link: layout_1.LpdfLayout.link,
|
|
51
|
+
table: layout_1.LpdfLayout.table,
|
|
52
|
+
thead: layout_1.LpdfLayout.thead,
|
|
53
|
+
tr: layout_1.LpdfLayout.tr,
|
|
54
|
+
td: layout_1.LpdfLayout.td,
|
|
55
|
+
text: layout_1.LpdfLayout.text,
|
|
56
|
+
span: layout_1.LpdfLayout.span,
|
|
57
|
+
divider: layout_1.LpdfLayout.divider,
|
|
58
|
+
img: layout_1.LpdfLayout.img,
|
|
59
|
+
barcode: layout_1.LpdfLayout.barcode,
|
|
60
|
+
region: layout_1.LpdfLayout.region,
|
|
61
|
+
// ── Canvas ────────────────────────────────────────────────────────────────
|
|
62
|
+
layer: canvas_1.LpdfCanvas.layer,
|
|
63
|
+
rect: canvas_1.LpdfCanvas.rect,
|
|
64
|
+
line: canvas_1.LpdfCanvas.line,
|
|
65
|
+
ellipse: canvas_1.LpdfCanvas.ellipse,
|
|
66
|
+
circle: canvas_1.LpdfCanvas.circle,
|
|
67
|
+
path: canvas_1.LpdfCanvas.path,
|
|
68
|
+
textAt: canvas_1.LpdfCanvas.textAt,
|
|
69
|
+
imgAt: canvas_1.LpdfCanvas.imgAt,
|
|
70
|
+
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lpdfio/lpdf",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Node.js
|
|
3
|
+
"version": "0.7.0",
|
|
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",
|
|
7
7
|
"exports": {
|