@pdfme/generator 3.4.3 → 4.0.0-dev.3

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.
Files changed (33) hide show
  1. package/dist/cjs/__tests__/generate.test.js +9 -0
  2. package/dist/cjs/__tests__/generate.test.js.map +1 -1
  3. package/dist/cjs/__tests__/integration1.test.js +2 -1
  4. package/dist/cjs/__tests__/integration1.test.js.map +1 -1
  5. package/dist/cjs/__tests__/integration2.test.js +2 -1
  6. package/dist/cjs/__tests__/integration2.test.js.map +1 -1
  7. package/dist/cjs/__tests__/integration3.test.js +2 -1
  8. package/dist/cjs/__tests__/integration3.test.js.map +1 -1
  9. package/dist/cjs/__tests__/integration4.test.js +2 -1
  10. package/dist/cjs/__tests__/integration4.test.js.map +1 -1
  11. package/dist/cjs/src/generate.js +29 -14
  12. package/dist/cjs/src/generate.js.map +1 -1
  13. package/dist/cjs/src/helper.js +55 -41
  14. package/dist/cjs/src/helper.js.map +1 -1
  15. package/dist/esm/__tests__/generate.test.js +9 -0
  16. package/dist/esm/__tests__/generate.test.js.map +1 -1
  17. package/dist/esm/__tests__/integration1.test.js +2 -1
  18. package/dist/esm/__tests__/integration1.test.js.map +1 -1
  19. package/dist/esm/__tests__/integration2.test.js +2 -1
  20. package/dist/esm/__tests__/integration2.test.js.map +1 -1
  21. package/dist/esm/__tests__/integration3.test.js +2 -1
  22. package/dist/esm/__tests__/integration3.test.js.map +1 -1
  23. package/dist/esm/__tests__/integration4.test.js +2 -1
  24. package/dist/esm/__tests__/integration4.test.js.map +1 -1
  25. package/dist/esm/src/generate.js +31 -16
  26. package/dist/esm/src/generate.js.map +1 -1
  27. package/dist/esm/src/helper.js +53 -39
  28. package/dist/esm/src/helper.js.map +1 -1
  29. package/dist/types/__tests__/assets/templates/index.d.ts +2656 -406
  30. package/dist/types/src/helper.d.ts +11 -17
  31. package/package.json +1 -1
  32. package/src/generate.ts +32 -19
  33. package/src/helper.ts +74 -64
@@ -11,6 +11,7 @@ describe('generate integrate test', () => {
11
11
  describe('basic generator', () => {
12
12
  const textObject = (x, y) => ({
13
13
  type: 'text',
14
+ content: '',
14
15
  position: { x, y },
15
16
  width: 100,
16
17
  height: 100,
@@ -80,6 +81,7 @@ describe('generate integrate test', () => {
80
81
  {
81
82
  name: {
82
83
  type: 'text',
84
+ content: '',
83
85
  position: { x: 30, y: 30 },
84
86
  width: 100,
85
87
  height: 20,
@@ -106,6 +108,7 @@ describe('generate integrate test', () => {
106
108
  {
107
109
  field1: {
108
110
  type: 'text',
111
+ content: '',
109
112
  position: { x: 30, y: 30 },
110
113
  width: 100,
111
114
  height: 20,
@@ -113,6 +116,7 @@ describe('generate integrate test', () => {
113
116
  },
114
117
  field2: {
115
118
  type: 'text',
119
+ content: '',
116
120
  position: { x: 60, y: 60 },
117
121
  width: 100,
118
122
  height: 20,
@@ -158,6 +162,7 @@ describe('check validation', () => {
158
162
  {
159
163
  a: {
160
164
  type: 'text',
165
+ content: '',
161
166
  position: { x: 0, y: 0 },
162
167
  width: 100,
163
168
  height: 100,
@@ -185,6 +190,7 @@ ERROR MESSAGE: Array must contain at least 1 element(s)
185
190
  {
186
191
  a: {
187
192
  type: 'text',
193
+ content: '',
188
194
  position: { x: 0, y: 0 },
189
195
  width: 100,
190
196
  height: 100,
@@ -212,6 +218,7 @@ Check this document: https://pdfme.com/docs/custom-fonts#about-font-type`);
212
218
  {
213
219
  a: {
214
220
  type: 'text',
221
+ content: '',
215
222
  position: { x: 0, y: 0 },
216
223
  width: 100,
217
224
  height: 100,
@@ -239,6 +246,7 @@ Check this document: https://pdfme.com/docs/custom-fonts#about-font-type`);
239
246
  {
240
247
  a: {
241
248
  type: 'text',
249
+ content: '',
242
250
  fontName: 'SauceHanSansJP2',
243
251
  position: { x: 0, y: 0 },
244
252
  width: 100,
@@ -246,6 +254,7 @@ Check this document: https://pdfme.com/docs/custom-fonts#about-font-type`);
246
254
  },
247
255
  b: {
248
256
  type: 'text',
257
+ content: '',
249
258
  position: { x: 0, y: 0 },
250
259
  width: 100,
251
260
  height: 100,
@@ -1 +1 @@
1
- {"version":3,"file":"generate.test.js","sourceRoot":"","sources":["../../../__tests__/generate.test.ts"],"names":[],"mappings":";;;;;AAAA,2BAAmC;AACnC,+DAAuC;AACvC,0CAA4D;AAC5D,mCAA2E;AAE3E,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC/B,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE,CAAC,CAAC;YACpD,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE;YAClB,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,GAAG;YACX,QAAQ,EAAE,EAAE;SACb,CAAC,CAAC;QAEH,MAAM,oBAAoB,GAAa;YACrC,OAAO,EAAE,kBAAS;YAClB,OAAO,EAAE;gBACP;oBACE,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC;oBACnB,CAAC,EAAE,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC;iBACtB;aACF;SACF,CAAC;QAEF,MAAM,oBAAoB,GAAa;YACrC,OAAO,EACL,07EAA07E;YAC57E,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;SAC9D,CAAC;QAEF,MAAM,YAAY,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAC1C,MAAM,WAAW,GAAG;YAClB,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE;YACtB,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE;SACvB,CAAC;QAEF,MAAM,SAAS,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AE,CAAC,CAAC;YACnE,IAAI,EAAE,CAAC;SACR;QAAC,OAAO,CAAM,EAAE;YACf,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CACvB;yDACiD,CAClD,CAAC;SACH;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const fs_1 = require("fs");
7
7
  const generate_1 = __importDefault(require("../src/generate"));
8
8
  const templates_1 = require("./assets/templates");
9
+ const common_1 = require("@pdfme/common");
9
10
  const schemas_1 = require("@pdfme/schemas");
10
11
  const utils_1 = require("./utils");
11
12
  const PERFORMANCE_THRESHOLD = parseFloat(process.env.PERFORMANCE_THRESHOLD || '1.5');
@@ -16,7 +17,7 @@ describe('generate integration test(label, envelope)', () => {
16
17
  const [key, template] = entries[l];
17
18
  // eslint-disable-next-line no-loop-func
18
19
  test(`snapshot ${key}`, async () => {
19
- const inputs = template.sampledata;
20
+ const inputs = (0, common_1.getInputFromTemplate)(template);
20
21
  const font = (0, utils_1.getFont)();
21
22
  font.SauceHanSansJP.fallback = false;
22
23
  font.SauceHanSerifJP.fallback = false;
@@ -1 +1 @@
1
- {"version":3,"file":"integration1.test.js","sourceRoot":"","sources":["../../../__tests__/integration1.test.ts"],"names":[],"mappings":";;;;;AAAA,2BAAmC;AACnC,+DAAuC;AACvC,kDAAqD;AACrD,4CAA6C;AAC7C,mCAA2E;AAE3E,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,KAAK,CAAC,CAAC;AAErF,QAAQ,CAAC,4CAA4C,EAAE,GAAG,EAAE;IAC1D,QAAQ,CAAC,IAAI,CAAC,CAAC,iBAAK,EAAE,oBAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,EAAE;QACtD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC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AAW,6CAA6C,qBAAqB,WAAW,CAAC,CAAC;iBACjJ;gBAED,MAAM,OAAO,GAAG,IAAA,qBAAa,EAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAC5C,MAAM,UAAU,GAAG,IAAA,wBAAgB,EAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAElD,IAAA,kBAAa,EAAC,OAAO,EAAE,GAAG,CAAC,CAAC;gBAC5B,MAAM,GAAG,GAAQ,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAA,cAAM,EAAC,OAAO,CAAC,EAAE,IAAA,cAAM,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBAC1E,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;gBACnB,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const fs_1 = require("fs");
7
7
  const generate_1 = __importDefault(require("../src/generate"));
8
8
  const templates_1 = require("./assets/templates");
9
+ const common_1 = require("@pdfme/common");
9
10
  const schemas_1 = require("@pdfme/schemas");
10
11
  const utils_1 = require("./utils");
11
12
  const PERFORMANCE_THRESHOLD = parseFloat(process.env.PERFORMANCE_THRESHOLD || '2.0');
@@ -16,7 +17,7 @@ describe('generate integration test(barcode, business)', () => {
16
17
  const [key, template] = entries[l];
17
18
  // eslint-disable-next-line no-loop-func
18
19
  test(`snapshot ${key}`, async () => {
19
- const inputs = template.sampledata;
20
+ const inputs = (0, common_1.getInputFromTemplate)(template);
20
21
  const font = (0, utils_1.getFont)();
21
22
  font.SauceHanSansJP.fallback = false;
22
23
  font.SauceHanSerifJP.fallback = false;
@@ -1 +1 @@
1
- {"version":3,"file":"integration2.test.js","sourceRoot":"","sources":["../../../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eAAK,EAAE,GAAG,kBAAQ,EAAE;oBACrC,OAAO,EAAE,EAAE,IAAI,EAAE;iBAClB,CAAC,CAAC;gBAEH,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBACtC,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;gBACrD,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE;oBAClB,MAAM,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;iBACzD;qBAAM,IAAI,WAAW,IAAI,qBAAqB,EAAE;oBAC/C,OAAO,CAAC,IAAI,CAAC,+BAA+B,GAAG,OAAO,WAAW,6CAA6C,qBAAqB,WAAW,CAAC,CAAC;iBACjJ;gBAED,MAAM,OAAO,GAAG,IAAA,qBAAa,EAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAC5C,MAAM,UAAU,GAAG,IAAA,wBAAgB,EAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAElD,IAAA,kBAAa,EAAC,OAAO,EAAE,GAAG,CAAC,CAAC;gBAC5B,MAAM,GAAG,GAAQ,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAA,cAAM,EAAC,OAAO,CAAC,EAAE,IAAA,cAAM,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBAC1E,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;gBACnB,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const fs_1 = require("fs");
7
7
  const generate_1 = __importDefault(require("../src/generate"));
8
8
  const templates_1 = require("./assets/templates");
9
+ const common_1 = require("@pdfme/common");
9
10
  const schemas_1 = require("@pdfme/schemas");
10
11
  const utils_1 = require("./utils");
11
12
  const signature = {
@@ -27,7 +28,7 @@ describe('generate integration test(other, shape)', () => {
27
28
  const [key, template] = entries[l];
28
29
  // eslint-disable-next-line no-loop-func
29
30
  test(`snapshot ${key}`, async () => {
30
- const inputs = template.sampledata;
31
+ const inputs = (0, common_1.getInputFromTemplate)(template);
31
32
  const font = (0, utils_1.getFont)();
32
33
  font.SauceHanSansJP.fallback = false;
33
34
  font.SauceHanSerifJP.fallback = false;
@@ -1 +1 @@
1
- {"version":3,"file":"integration3.test.js","sourceRoot":"","sources":["../../../__tests__/integration3.test.ts"],"names":[],"mappings":";;;;;AAAA,2BAAmC;AACnC,+DAAuC;AACvC,kDAAkD;AAClD,4CASwB;AACxB,mCAA2E;AAE3E,MAAM,SAAS,GAAG;IAChB,GAAG,EAAE,eAAK,CAAC,GAAG;IACd,EAAE,EAAE,GAAG,EAAE,GAAE,CAAC;IACZ,SAAS,EAAE;QACT,GAAG,eAAK,CAAC,SAAS;QAClB,aAAa,EAAE;YACb,GAAG,eAAK,CAAC,SAAS,CAAC,aAAa;YAChC,IAAI,EAAE,WAAW;SAClB;KACF;CACF,CAAC;AAEF,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,KAAK,CAAC,CAAC;AAErF,QAAQ,CAAC,yCAAyC,EAAE,GAAG,EAAE;IACvD,QAAQ,CAAC,IAAI,CAAC,CAAC,iBAAK,EAAE,iBAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,EAAE;QACnD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAC1C,MAAM,CAAC,GAAG,EAAE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,sBAAY;wBACZ,WAAW,EAAX,qBAAW;qBACZ;oBACD,OAAO,EAAE,EAAE,IAAI,EAAE;iBAClB,CAAC,CAAC;gBAEH,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBACtC,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;gBACrD,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE;oBAClB,MAAM,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;iBACzD;qBAAM,IAAI,WAAW,IAAI,qBAAqB,EAAE;oBAC/C,OAAO,CAAC,IAAI,CAAC,+BAA+B,GAAG,OAAO,WAAW,6CAA6C,qBAAqB,WAAW,CAAC,CAAC;iBACjJ;gBAED,MAAM,OAAO,GAAG,IAAA,qBAAa,EAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAC5C,MAAM,UAAU,GAAG,IAAA,wBAAgB,EAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAElD,IAAA,kBAAa,EAAC,OAAO,EAAE,GAAG,CAAC,CAAC;gBAC5B,MAAM,GAAG,GAAQ,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAA,cAAM,EAAC,OAAO,CAAC,EAAE,IAAA,cAAM,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBAC1E,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;gBACnB,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const fs_1 = require("fs");
7
7
  const generate_1 = __importDefault(require("../src/generate"));
8
8
  const templates_1 = require("./assets/templates");
9
+ const common_1 = require("@pdfme/common");
9
10
  const schemas_1 = require("@pdfme/schemas");
10
11
  const utils_1 = require("./utils");
11
12
  const PERFORMANCE_THRESHOLD = parseFloat(process.env.PERFORMANCE_THRESHOLD || '2.5');
@@ -16,7 +17,7 @@ describe('generate integration test(slower)', () => {
16
17
  const [key, template] = entries[l];
17
18
  // eslint-disable-next-line no-loop-func
18
19
  test(`snapshot ${key}`, async () => {
19
- const inputs = template.sampledata;
20
+ const inputs = (0, common_1.getInputFromTemplate)(template);
20
21
  const font = (0, utils_1.getFont)();
21
22
  font.SauceHanSansJP.fallback = false;
22
23
  font.SauceHanSerifJP.fallback = false;
@@ -1 +1 @@
1
- {"version":3,"file":"integration4.test.js","sourceRoot":"","sources":["../../../__tests__/integration4.test.ts"],"names":[],"mappings":";;;;;AAAA,2BAAmC;AACnC,+DAAuC;AACvC,kDAA8C;AAC9C,4CAAuD;AACvD,mCAA2E;AAE3E,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,KAAK,CAAC,CAAC;AAErF,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,QAAQ,CAAC,IAAI,CAAC,CAAC,oBAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,EAAE;QAC/C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAC1C,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAEnC,wCAAwC;YACxC,IAAI,CAAC,YAAY,GAAG,EAAE,EAAE,KAAK,IAAI,EAAE;gBACjC,MAAM,MAAM,GAAG,QAAQ,CAAC,UAAW,CAAC;gBAEpC,MAAM,IAAI,GA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AAG,CAAC,CAAC,IAAA,cAAM,EAAC,OAAO,CAAC,EAAE,IAAA,cAAM,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBAC1E,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;gBACnB,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -25,30 +25,45 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const pdfLib = __importStar(require("@pdfme/pdf-lib"));
27
27
  const common_1 = require("@pdfme/common");
28
+ const schemas_1 = require("@pdfme/schemas");
28
29
  const helper_js_1 = require("./helper.js");
29
30
  const generate = async (props) => {
30
31
  (0, common_1.checkGenerateProps)(props);
31
32
  const { inputs, template, options = {}, plugins: userPlugins = {} } = props;
33
+ const basePdf = template.basePdf;
32
34
  if (inputs.length === 0) {
33
35
  throw new Error('inputs should not be empty');
34
36
  }
35
- const { pdfDoc, embeddedPages, embedPdfBoxes, renderObj, readOnlySchemaKeys } = await (0, helper_js_1.preprocessing)({ template, userPlugins });
36
- const keys = readOnlySchemaKeys.concat(Object.keys(inputs[0]));
37
- if (template.columns) {
38
- keys.sort((a, b) => (template.columns ?? []).indexOf(a) - (template.columns ?? []).indexOf(b));
39
- }
37
+ const { pdfDoc, renderObj } = await (0, helper_js_1.preprocessing)({ template, userPlugins });
40
38
  const _cache = new Map();
41
39
  for (let i = 0; i < inputs.length; i += 1) {
42
- const inputObj = inputs[i];
43
- for (let j = 0; j < embeddedPages.length; j += 1) {
44
- const embeddedPage = embeddedPages[j];
45
- const { width: pageWidth, height: pageHeight } = embeddedPage;
40
+ const input = inputs[i];
41
+ const dynamicTemplate = await (0, common_1.getDynamicTemplate)({
42
+ template,
43
+ input,
44
+ options,
45
+ _cache,
46
+ modifyTemplate: (arg) => {
47
+ return (0, schemas_1.modifyTemplateForTable)(arg);
48
+ },
49
+ getDynamicHeight: (value, args) => {
50
+ if (args.schema.type !== 'table')
51
+ return Promise.resolve(args.schema.height);
52
+ return (0, schemas_1.getDynamicHeightForTable)(value, args);
53
+ },
54
+ });
55
+ const { basePages, embedPdfBoxes } = await (0, helper_js_1.getEmbedPdfPages)({
56
+ template: dynamicTemplate,
57
+ pdfDoc,
58
+ });
59
+ const keys = dynamicTemplate.schemas.flatMap((schemaObj) => Object.keys(schemaObj));
60
+ for (let j = 0; j < basePages.length; j += 1) {
61
+ const basePage = basePages[j];
46
62
  const embedPdfBox = embedPdfBoxes[j];
47
- const page = pdfDoc.addPage([pageWidth, pageHeight]);
48
- (0, helper_js_1.drawEmbeddedPage)({ page, embeddedPage, embedPdfBox });
63
+ const page = (0, helper_js_1.insertPage)({ basePage, embedPdfBox, pdfDoc });
49
64
  for (let l = 0; l < keys.length; l += 1) {
50
65
  const key = keys[l];
51
- const schemaObj = template.schemas[j];
66
+ const schemaObj = dynamicTemplate.schemas[j] || {};
52
67
  const schema = schemaObj[key];
53
68
  if (!schema) {
54
69
  continue;
@@ -57,8 +72,8 @@ const generate = async (props) => {
57
72
  if (!render) {
58
73
  continue;
59
74
  }
60
- const value = schema.readOnly ? schema.readOnlyValue || '' : inputObj[key];
61
- await render({ key, value, schema, pdfLib, pdfDoc, page, options, _cache });
75
+ const value = schema.readOnly ? schema.content || '' : input[key];
76
+ await render({ key, value, schema, basePdf, pdfLib, pdfDoc, page, options, _cache });
62
77
  }
63
78
  }
64
79
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/generate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAyC;AAEzC,0CAAmD;AACnD,2CAA8E;AAE9E,MAAM,QAAQ,GAAG,KAAK,EAAE,KAAoB,EAAE,EAAE;IAC9C,IAAA,2BAAkB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M,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;aACtF;SACF;KACF;IAED,IAAA,0BAAc,EAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAEpC,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
@@ -23,51 +23,56 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.postProcessing = exports.preprocessing = exports.drawEmbeddedPage = exports.getEmbeddedPagesAndEmbedPdfBoxes = void 0;
26
+ exports.insertPage = exports.postProcessing = exports.preprocessing = exports.getEmbedPdfPages = void 0;
27
27
  const fontkit = __importStar(require("fontkit"));
28
- const pdfLib = __importStar(require("@pdfme/pdf-lib"));
28
+ const common_1 = require("@pdfme/common");
29
29
  const schemas_1 = require("@pdfme/schemas");
30
30
  const pdf_lib_1 = require("@pdfme/pdf-lib");
31
- const common_1 = require("@pdfme/common");
32
31
  const constants_js_1 = require("./constants.js");
33
- const getEmbeddedPagesAndEmbedPdfBoxes = async (arg) => {
34
- const { pdfDoc, basePdf } = arg;
35
- let embeddedPages = [];
32
+ const getEmbedPdfPages = async (arg) => {
33
+ const { template: { schemas, basePdf }, pdfDoc, } = arg;
34
+ let basePages = [];
36
35
  let embedPdfBoxes = [];
37
- const willLoadPdf = typeof basePdf === 'string' ? await (0, common_1.getB64BasePdf)(basePdf) : basePdf;
38
- const embedPdf = await pdf_lib_1.PDFDocument.load(willLoadPdf);
39
- const embedPdfPages = embedPdf.getPages();
40
- embedPdfBoxes = embedPdfPages.map((p) => ({
41
- mediaBox: p.getMediaBox(),
42
- bleedBox: p.getBleedBox(),
43
- trimBox: p.getTrimBox(),
44
- }));
45
- const boundingBoxes = embedPdfPages.map((p) => {
46
- const { x, y, width, height } = p.getMediaBox();
47
- return { left: x, bottom: y, right: width, top: height + y };
48
- });
49
- const transformationMatrices = embedPdfPages.map(() => [1, 0, 0, 1, 0, 0]);
50
- embeddedPages = await pdfDoc.embedPages(embedPdfPages, boundingBoxes, transformationMatrices);
51
- return { embeddedPages, embedPdfBoxes };
52
- };
53
- exports.getEmbeddedPagesAndEmbedPdfBoxes = getEmbeddedPagesAndEmbedPdfBoxes;
54
- const drawEmbeddedPage = (arg) => {
55
- const { page, embeddedPage, embedPdfBox } = arg;
56
- page.drawPage(embeddedPage);
57
- const { mediaBox: mb, bleedBox: bb, trimBox: tb } = embedPdfBox;
58
- page.setMediaBox(mb.x, mb.y, mb.width, mb.height);
59
- page.setBleedBox(bb.x, bb.y, bb.width, bb.height);
60
- page.setTrimBox(tb.x, tb.y, tb.width, tb.height);
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 = typeof basePdf === 'string' ? await (0, common_1.getB64BasePdf)(basePdf) : 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 };
61
68
  };
62
- exports.drawEmbeddedPage = drawEmbeddedPage;
69
+ exports.getEmbedPdfPages = getEmbedPdfPages;
63
70
  const preprocessing = async (arg) => {
64
71
  const { template, userPlugins } = arg;
65
- const { basePdf, schemas } = template;
66
- const pdfDoc = await pdfLib.PDFDocument.create();
72
+ const { schemas } = template;
73
+ const pdfDoc = await pdf_lib_1.PDFDocument.create();
67
74
  // @ts-ignore
68
75
  pdfDoc.registerFontkit(fontkit);
69
- const pagesAndBoxes = await (0, exports.getEmbeddedPagesAndEmbedPdfBoxes)({ pdfDoc, basePdf });
70
- const { embeddedPages, embedPdfBoxes } = pagesAndBoxes;
71
76
  const pluginValues = (Object.values(userPlugins).length > 0
72
77
  ? Object.values(userPlugins)
73
78
  : Object.values(schemas_1.builtInPlugins));
@@ -80,12 +85,7 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
80
85
  }
81
86
  return { ...acc, [type]: render.pdf };
82
87
  }, {});
83
- const readOnlySchemaKeys = schemas.reduce((acc, schema) => {
84
- const entries = Object.entries(schema);
85
- const keys = entries.reduce((acc, [key, value]) => (value.readOnly ? [...acc, key] : acc), []);
86
- return [...acc, ...keys];
87
- }, []);
88
- return { pdfDoc, embeddedPages, embedPdfBoxes, renderObj, readOnlySchemaKeys };
88
+ return { pdfDoc, renderObj };
89
89
  };
90
90
  exports.preprocessing = preprocessing;
91
91
  const postProcessing = (props) => {
@@ -102,4 +102,18 @@ const postProcessing = (props) => {
102
102
  pdfDoc.setTitle(title);
103
103
  };
104
104
  exports.postProcessing = postProcessing;
105
+ const insertPage = (arg) => {
106
+ const { basePage, embedPdfBox, pdfDoc } = arg;
107
+ const size = basePage instanceof pdf_lib_1.PDFEmbeddedPage ? basePage.size() : basePage.getSize();
108
+ const insertedPage = pdfDoc.addPage([size.width, size.height]);
109
+ if (basePage instanceof pdf_lib_1.PDFEmbeddedPage) {
110
+ insertedPage.drawPage(basePage);
111
+ const { mediaBox, bleedBox, trimBox } = embedPdfBox;
112
+ insertedPage.setMediaBox(mediaBox.x, mediaBox.y, mediaBox.width, mediaBox.height);
113
+ insertedPage.setBleedBox(bleedBox.x, bleedBox.y, bleedBox.width, bleedBox.height);
114
+ insertedPage.setTrimBox(trimBox.x, trimBox.y, trimBox.width, trimBox.height);
115
+ }
116
+ return insertedPage;
117
+ };
118
+ exports.insertPage = insertPage;
105
119
  //# sourceMappingURL=helper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AACnC,uDAAyC;AAGzC,4CAAgD;AAChD,4CAA6F;AAC7F,0CAAuD;AACvD,iDAA2C;AAGpC,MAAM,gCAAgC,GAAG,KAAK,EAAE,GAGtD,EAAE,EAAE;IACH,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC;IAChC,IAAI,aAAa,GAAsB,EAAE,CAAC;IAC1C,IAAI,aAAa,GAAkB,EAAE,CAAC;IACtC,MAAM,WAAW,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,IAAA,sBAAa,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IACzF,MAAM,QAAQ,GAAG,MAAM,qBAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACrD,MAAM,aAAa,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAE1C,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACxC,QAAQ,EAAE,CAAC,CAAC,WAAW,EAAE;QACzB,QAAQ,EAAE,CAAC,CAA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,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;KAC9E;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAlBW,QAAA,UAAU,cAkBrB"}
@@ -6,6 +6,7 @@ describe('generate integrate test', () => {
6
6
  describe('basic generator', () => {
7
7
  const textObject = (x, y) => ({
8
8
  type: 'text',
9
+ content: '',
9
10
  position: { x, y },
10
11
  width: 100,
11
12
  height: 100,
@@ -75,6 +76,7 @@ describe('generate integrate test', () => {
75
76
  {
76
77
  name: {
77
78
  type: 'text',
79
+ content: '',
78
80
  position: { x: 30, y: 30 },
79
81
  width: 100,
80
82
  height: 20,
@@ -101,6 +103,7 @@ describe('generate integrate test', () => {
101
103
  {
102
104
  field1: {
103
105
  type: 'text',
106
+ content: '',
104
107
  position: { x: 30, y: 30 },
105
108
  width: 100,
106
109
  height: 20,
@@ -108,6 +111,7 @@ describe('generate integrate test', () => {
108
111
  },
109
112
  field2: {
110
113
  type: 'text',
114
+ content: '',
111
115
  position: { x: 60, y: 60 },
112
116
  width: 100,
113
117
  height: 20,
@@ -153,6 +157,7 @@ describe('check validation', () => {
153
157
  {
154
158
  a: {
155
159
  type: 'text',
160
+ content: '',
156
161
  position: { x: 0, y: 0 },
157
162
  width: 100,
158
163
  height: 100,
@@ -180,6 +185,7 @@ ERROR MESSAGE: Array must contain at least 1 element(s)
180
185
  {
181
186
  a: {
182
187
  type: 'text',
188
+ content: '',
183
189
  position: { x: 0, y: 0 },
184
190
  width: 100,
185
191
  height: 100,
@@ -207,6 +213,7 @@ Check this document: https://pdfme.com/docs/custom-fonts#about-font-type`);
207
213
  {
208
214
  a: {
209
215
  type: 'text',
216
+ content: '',
210
217
  position: { x: 0, y: 0 },
211
218
  width: 100,
212
219
  height: 100,
@@ -234,6 +241,7 @@ Check this document: https://pdfme.com/docs/custom-fonts#about-font-type`);
234
241
  {
235
242
  a: {
236
243
  type: 'text',
244
+ content: '',
237
245
  fontName: 'SauceHanSansJP2',
238
246
  position: { x: 0, y: 0 },
239
247
  width: 100,
@@ -241,6 +249,7 @@ Check this document: https://pdfme.com/docs/custom-fonts#about-font-type`);
241
249
  },
242
250
  b: {
243
251
  type: 'text',
252
+ content: '',
244
253
  position: { x: 0, y: 0 },
245
254
  width: 100,
246
255
  height: 100,
@@ -1 +1 @@
1
- {"version":3,"file":"generate.test.js","sourceRoot":"","sources":["../../../__tests__/generate.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAY,SAAS,EAAU,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3E,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC/B,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE,CAAC,CAAC;YACpD,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE;YAClB,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,GAAG;YACX,QAAQ,EAAE,EAAE;SACb,CAAC,CAAC;QAEH,MAAM,oBAAoB,GAAa;YACrC,OAAO,EAAE,SAAS;YAClB,OAAO,EAAE;gBACP;oBACE,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC;oBACnB,CAAC,EAAE,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC;iBACtB;aACF;SACF,CAAC;QAEF,MAAM,oBAAoB,GAAa;YACrC,OAAO,EACL,07EAA07E;YAC57E,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC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AAC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;YACnE,IAAI,EAAE,CAAC;SACR;QAAC,OAAO,CAAM,EAAE;YACf,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CACvB;yDACiD,CAClD,CAAC;SACH;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { writeFileSync } from 'fs';
2
2
  import generate from '../src/generate';
3
3
  import { label, envelope } from './assets/templates';
4
+ import { getInputFromTemplate } from '@pdfme/common';
4
5
  import { text, image } from '@pdfme/schemas';
5
6
  import { getFont, getPdf, getPdfTmpPath, getPdfAssertPath } from './utils';
6
7
  const PERFORMANCE_THRESHOLD = parseFloat(process.env.PERFORMANCE_THRESHOLD || '1.5');
@@ -11,7 +12,7 @@ describe('generate integration test(label, envelope)', () => {
11
12
  const [key, template] = entries[l];
12
13
  // eslint-disable-next-line no-loop-func
13
14
  test(`snapshot ${key}`, async () => {
14
- const inputs = template.sampledata;
15
+ const inputs = getInputFromTemplate(template);
15
16
  const font = getFont();
16
17
  font.SauceHanSansJP.fallback = false;
17
18
  font.SauceHanSerifJP.fallback = false;