@pdfme/generator 5.3.5 → 5.3.7-dev.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/dist/cjs/__tests__/generate.test.js +21 -22
- package/dist/cjs/__tests__/generate.test.js.map +1 -1
- package/dist/cjs/__tests__/integration1.test.js +7 -7
- package/dist/cjs/__tests__/integration1.test.js.map +1 -1
- package/dist/cjs/__tests__/integration2.test.js +7 -7
- package/dist/cjs/__tests__/integration2.test.js.map +1 -1
- package/dist/cjs/__tests__/integration3.test.js +7 -7
- package/dist/cjs/__tests__/integration3.test.js.map +1 -1
- package/dist/cjs/__tests__/integration4.test.js +7 -7
- package/dist/cjs/__tests__/integration4.test.js.map +1 -1
- package/dist/cjs/__tests__/integration5.test.js +7 -7
- package/dist/cjs/__tests__/integration5.test.js.map +1 -1
- package/dist/cjs/__tests__/utils.js +6 -15
- package/dist/cjs/__tests__/utils.js.map +1 -1
- package/dist/esm/__tests__/generate.test.js +22 -23
- package/dist/esm/__tests__/generate.test.js.map +1 -1
- package/dist/esm/__tests__/integration1.test.js +8 -8
- package/dist/esm/__tests__/integration1.test.js.map +1 -1
- package/dist/esm/__tests__/integration2.test.js +8 -8
- package/dist/esm/__tests__/integration2.test.js.map +1 -1
- package/dist/esm/__tests__/integration3.test.js +8 -8
- package/dist/esm/__tests__/integration3.test.js.map +1 -1
- package/dist/esm/__tests__/integration4.test.js +9 -9
- package/dist/esm/__tests__/integration4.test.js.map +1 -1
- package/dist/esm/__tests__/integration5.test.js +9 -9
- package/dist/esm/__tests__/integration5.test.js.map +1 -1
- package/dist/esm/__tests__/utils.js +4 -11
- package/dist/esm/__tests__/utils.js.map +1 -1
- package/dist/node/__tests__/assets/templates/index.js +121 -0
- package/dist/node/__tests__/assets/templates/index.js.map +1 -0
- package/dist/node/__tests__/generate.test.js +280 -0
- package/dist/node/__tests__/generate.test.js.map +1 -0
- package/dist/node/__tests__/integration1.test.js +52 -0
- package/dist/node/__tests__/integration1.test.js.map +1 -0
- package/dist/node/__tests__/integration2.test.js +52 -0
- package/dist/node/__tests__/integration2.test.js.map +1 -0
- package/dist/node/__tests__/integration3.test.js +72 -0
- package/dist/node/__tests__/integration3.test.js.map +1 -0
- package/dist/node/__tests__/integration4.test.js +53 -0
- package/dist/node/__tests__/integration4.test.js.map +1 -0
- package/dist/node/__tests__/integration5.test.js +53 -0
- package/dist/node/__tests__/integration5.test.js.map +1 -0
- package/dist/node/__tests__/utils.js +60 -0
- package/dist/node/__tests__/utils.js.map +1 -0
- package/dist/node/src/constants.js +5 -0
- package/dist/node/src/constants.js.map +1 -0
- package/dist/node/src/generate.js +137 -0
- package/dist/node/src/generate.js.map +1 -0
- package/dist/node/src/helper.js +132 -0
- package/dist/node/src/helper.js.map +1 -0
- package/dist/node/src/index.js +9 -0
- package/dist/node/src/index.js.map +1 -0
- package/dist/node/src/types.js +3 -0
- package/dist/node/src/types.js.map +1 -0
- package/dist/types/__tests__/generate.test.d.ts +1 -1
- package/dist/types/__tests__/integration1.test.d.ts +1 -1
- package/dist/types/__tests__/integration2.test.d.ts +1 -1
- package/dist/types/__tests__/integration3.test.d.ts +1 -1
- package/dist/types/__tests__/integration4.test.d.ts +1 -1
- package/dist/types/__tests__/integration5.test.d.ts +1 -1
- package/dist/types/__tests__/utils.d.ts +3 -3
- package/jest.setup.js +2 -0
- package/package.json +13 -5
- package/tsconfig.cjs.json +1 -1
- package/tsconfig.esm.json +1 -1
- package/tsconfig.node.json +10 -0
@@ -0,0 +1,132 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
exports.insertPage = exports.postProcessing = exports.preprocessing = exports.validateRequiredFields = exports.getEmbedPdfPages = void 0;
|
27
|
+
const fontkit = __importStar(require("fontkit"));
|
28
|
+
const common_1 = require("@pdfme/common");
|
29
|
+
const schemas_1 = require("@pdfme/schemas");
|
30
|
+
const pdf_lib_1 = require("@pdfme/pdf-lib");
|
31
|
+
const constants_js_1 = require("./constants.js");
|
32
|
+
const getEmbedPdfPages = async (arg) => {
|
33
|
+
const { template: { schemas, basePdf }, pdfDoc, } = arg;
|
34
|
+
let basePages = [];
|
35
|
+
let embedPdfBoxes = [];
|
36
|
+
if ((0, common_1.isBlankPdf)(basePdf)) {
|
37
|
+
const { width: _width, height: _height } = basePdf;
|
38
|
+
const width = (0, common_1.mm2pt)(_width);
|
39
|
+
const height = (0, common_1.mm2pt)(_height);
|
40
|
+
basePages = schemas.map(() => {
|
41
|
+
const page = pdf_lib_1.PDFPage.create(pdfDoc);
|
42
|
+
page.setSize(width, height);
|
43
|
+
return page;
|
44
|
+
});
|
45
|
+
embedPdfBoxes = schemas.map(() => ({
|
46
|
+
mediaBox: { x: 0, y: 0, width, height },
|
47
|
+
bleedBox: { x: 0, y: 0, width, height },
|
48
|
+
trimBox: { x: 0, y: 0, width, height },
|
49
|
+
}));
|
50
|
+
}
|
51
|
+
else {
|
52
|
+
const willLoadPdf = await (0, common_1.getB64BasePdf)(basePdf);
|
53
|
+
const embedPdf = await pdf_lib_1.PDFDocument.load(willLoadPdf);
|
54
|
+
const embedPdfPages = embedPdf.getPages();
|
55
|
+
embedPdfBoxes = embedPdfPages.map((p) => ({
|
56
|
+
mediaBox: p.getMediaBox(),
|
57
|
+
bleedBox: p.getBleedBox(),
|
58
|
+
trimBox: p.getTrimBox(),
|
59
|
+
}));
|
60
|
+
const boundingBoxes = embedPdfPages.map((p) => {
|
61
|
+
const { x, y, width, height } = p.getMediaBox();
|
62
|
+
return { left: x, bottom: y, right: width, top: height + y };
|
63
|
+
});
|
64
|
+
const transformationMatrices = embedPdfPages.map(() => [1, 0, 0, 1, 0, 0]);
|
65
|
+
basePages = await pdfDoc.embedPages(embedPdfPages, boundingBoxes, transformationMatrices);
|
66
|
+
}
|
67
|
+
return { basePages, embedPdfBoxes };
|
68
|
+
};
|
69
|
+
exports.getEmbedPdfPages = getEmbedPdfPages;
|
70
|
+
const validateRequiredFields = (template, inputs) => {
|
71
|
+
template.schemas.forEach((schemaPage) => schemaPage.forEach((schema) => {
|
72
|
+
if (schema.required && !schema.readOnly && !inputs.some((input) => input[schema.name])) {
|
73
|
+
throw new Error(`[@pdfme/generator] input for '${schema.name}' is required to generate this PDF`);
|
74
|
+
}
|
75
|
+
}));
|
76
|
+
};
|
77
|
+
exports.validateRequiredFields = validateRequiredFields;
|
78
|
+
const preprocessing = async (arg) => {
|
79
|
+
const { template, userPlugins } = arg;
|
80
|
+
const { schemas, basePdf } = template;
|
81
|
+
const staticSchema = (0, common_1.isBlankPdf)(basePdf) ? (basePdf.staticSchema ?? []) : [];
|
82
|
+
const pdfDoc = await pdf_lib_1.PDFDocument.create();
|
83
|
+
// @ts-ignore
|
84
|
+
pdfDoc.registerFontkit(fontkit);
|
85
|
+
const pluginValues = (Object.values(userPlugins).length > 0
|
86
|
+
? Object.values(userPlugins)
|
87
|
+
: Object.values(schemas_1.builtInPlugins));
|
88
|
+
const schemaTypes = Array.from(new Set(schemas
|
89
|
+
.flatMap((schemaPage) => schemaPage.map((schema) => schema.type))
|
90
|
+
.concat(staticSchema.map((schema) => schema.type))));
|
91
|
+
const renderObj = schemaTypes.reduce((acc, type) => {
|
92
|
+
const render = pluginValues.find((pv) => pv.propPanel.defaultSchema.type === type);
|
93
|
+
if (!render) {
|
94
|
+
throw new Error(`[@pdfme/generator] Renderer for type ${type} not found.
|
95
|
+
Check this document: https://pdfme.com/docs/custom-schemas`);
|
96
|
+
}
|
97
|
+
return { ...acc, [type]: render.pdf };
|
98
|
+
}, {});
|
99
|
+
return { pdfDoc, renderObj };
|
100
|
+
};
|
101
|
+
exports.preprocessing = preprocessing;
|
102
|
+
const postProcessing = (props) => {
|
103
|
+
const { pdfDoc, options } = props;
|
104
|
+
const { author = constants_js_1.TOOL_NAME, creationDate = new Date(), creator = constants_js_1.TOOL_NAME, keywords = [], lang = 'en', modificationDate = new Date(), producer = constants_js_1.TOOL_NAME, subject = '', title = '', } = options;
|
105
|
+
pdfDoc.setAuthor(author);
|
106
|
+
pdfDoc.setCreationDate(creationDate);
|
107
|
+
pdfDoc.setCreator(creator);
|
108
|
+
pdfDoc.setKeywords(keywords);
|
109
|
+
pdfDoc.setLanguage(lang);
|
110
|
+
pdfDoc.setModificationDate(modificationDate);
|
111
|
+
pdfDoc.setProducer(producer);
|
112
|
+
pdfDoc.setSubject(subject);
|
113
|
+
pdfDoc.setTitle(title);
|
114
|
+
};
|
115
|
+
exports.postProcessing = postProcessing;
|
116
|
+
const insertPage = (arg) => {
|
117
|
+
const { basePage, embedPdfBox, pdfDoc } = arg;
|
118
|
+
const size = basePage instanceof pdf_lib_1.PDFEmbeddedPage ? basePage.size() : basePage.getSize();
|
119
|
+
const insertedPage = basePage instanceof pdf_lib_1.PDFEmbeddedPage
|
120
|
+
? pdfDoc.addPage([size.width, size.height])
|
121
|
+
: pdfDoc.addPage(basePage);
|
122
|
+
if (basePage instanceof pdf_lib_1.PDFEmbeddedPage) {
|
123
|
+
insertedPage.drawPage(basePage);
|
124
|
+
const { mediaBox, bleedBox, trimBox } = embedPdfBox;
|
125
|
+
insertedPage.setMediaBox(mediaBox.x, mediaBox.y, mediaBox.width, mediaBox.height);
|
126
|
+
insertedPage.setBleedBox(bleedBox.x, bleedBox.y, bleedBox.width, bleedBox.height);
|
127
|
+
insertedPage.setTrimBox(trimBox.x, trimBox.y, trimBox.width, trimBox.height);
|
128
|
+
}
|
129
|
+
return insertedPage;
|
130
|
+
};
|
131
|
+
exports.insertPage = insertPage;
|
132
|
+
//# sourceMappingURL=helper.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AACnC,0CAUuB;AACvB,4CAAgD;AAChD,4CAA6F;AAC7F,iDAA2C;AAGpC,MAAM,gBAAgB,GAAG,KAAK,EAAE,GAAgD,EAAE,EAAE;IACzF,MAAM,EACJ,QAAQ,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAC9B,MAAM,GACP,GAAG,GAAG,CAAC;IACR,IAAI,SAAS,GAAkC,EAAE,CAAC;IAClD,IAAI,aAAa,GAAkB,EAAE,CAAC;IAEtC,IAAI,IAAA,mBAAU,EAAC,OAAO,CAAC,EAAE;QACvB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QACnD,MAAM,KAAK,GAAG,IAAA,cAAK,EAAC,MAAM,CAAC,CAAC;QAC5B,MAAM,MAAM,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,CAAC;QAC9B,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE;YAC3B,MAAM,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AAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3C,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE/B,IAAI,QAAQ,YAAY,yBAAe,EAAE;QACvC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAChC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC;QACpD,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QAClF,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QAClF,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;KAC9E;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AArBW,QAAA,UAAU,cAqBrB"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.generate = void 0;
|
7
|
+
const generate_1 = __importDefault(require("./generate"));
|
8
|
+
exports.generate = generate_1.default;
|
9
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAEzB,mBAFF,kBAAQ,CAEE"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":""}
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
import 'jest-image-snapshot';
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
import 'jest-image-snapshot';
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
import 'jest-image-snapshot';
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
import 'jest-image-snapshot';
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
import 'jest-image-snapshot';
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
import 'jest-image-snapshot';
|
@@ -1,5 +1,5 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
/// <reference types="node" />
|
1
3
|
import { Font } from '@pdfme/common';
|
2
4
|
export declare const getFont: () => Font;
|
3
|
-
export declare const
|
4
|
-
export declare const getPdfTmpPath: (fileName: string) => string;
|
5
|
-
export declare const getPdfAssertPath: (fileName: string) => string;
|
5
|
+
export declare const pdfToImages: (pdf: ArrayBuffer) => Promise<Buffer[]>;
|
package/jest.setup.js
ADDED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pdfme/generator",
|
3
|
-
"version": "5.3.
|
3
|
+
"version": "5.3.7-dev.1",
|
4
4
|
"sideEffects": false,
|
5
5
|
"author": "hand-dot",
|
6
6
|
"license": "MIT",
|
@@ -26,19 +26,24 @@
|
|
26
26
|
"types": "dist/types/src/index.d.ts",
|
27
27
|
"exports": {
|
28
28
|
".": {
|
29
|
-
"import":
|
29
|
+
"import": {
|
30
|
+
"node": "./dist/node/src/index.js",
|
31
|
+
"default": "./dist/esm/src/index.js"
|
32
|
+
},
|
30
33
|
"require": "./dist/cjs/src/index.js",
|
31
34
|
"types": "./dist/types/src/index.d.ts"
|
32
35
|
}
|
33
36
|
},
|
34
37
|
"scripts": {
|
35
38
|
"dev": "tsc -p tsconfig.esm.json -w",
|
36
|
-
"build": "npm-run-all --parallel build:cjs build:esm",
|
39
|
+
"build": "npm-run-all --parallel build:cjs build:esm build:node",
|
37
40
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
38
41
|
"build:esm": "tsc -p tsconfig.esm.json",
|
42
|
+
"build:node": "tsc -p tsconfig.node.json",
|
39
43
|
"clean": "rimraf dist",
|
40
44
|
"lint": "eslint --ext .ts src",
|
41
45
|
"test": "jest",
|
46
|
+
"test:update-snapshots": "jest --updateSnapshot",
|
42
47
|
"prune": "ts-prune src",
|
43
48
|
"prettier": "prettier --write 'src/**/*.ts'"
|
44
49
|
},
|
@@ -49,8 +54,8 @@
|
|
49
54
|
},
|
50
55
|
"devDependencies": {
|
51
56
|
"@pdfme/common": "file:../common",
|
52
|
-
"@pdfme/
|
53
|
-
"
|
57
|
+
"@pdfme/converter": "file:../converter",
|
58
|
+
"@pdfme/schemas": "file:../schemas"
|
54
59
|
},
|
55
60
|
"peerDependencies": {
|
56
61
|
"@pdfme/common": "latest",
|
@@ -58,6 +63,9 @@
|
|
58
63
|
},
|
59
64
|
"jest": {
|
60
65
|
"resolver": "ts-jest-resolver",
|
66
|
+
"setupFilesAfterEnv": [
|
67
|
+
"<rootDir>/jest.setup.js"
|
68
|
+
],
|
61
69
|
"moduleNameMapper": {
|
62
70
|
"^@pdfme/schemas/utils$": "<rootDir>/../schemas/src/utils.ts",
|
63
71
|
"^.+\\\\.(css|less|scss)$": "identity-obj-proxy"
|
package/tsconfig.cjs.json
CHANGED
package/tsconfig.esm.json
CHANGED