mirror of
https://github.com/pdfme/pdfme.git
synced 2026-02-19 15:25:29 -05:00
feat: add PDF generation and merging functionality in node-playground
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
"clean:generator": "npm run -w packages/generator clean",
|
||||
"clean:manipulator": "npm run -w packages/manipulator clean",
|
||||
"clean:ui": "npm run -w packages/ui clean",
|
||||
"build": "npm run clean && npm run build:common && npm run build:converter && npm run build:schemas && npm-run-all --parallel build:generator build:ui",
|
||||
"build": "npm run clean && npm run build:common && npm run build:converter && npm run build:schemas && npm-run-all --parallel build:generator build:ui build:manipulator",
|
||||
"build:common": "npm run -w packages/common build",
|
||||
"build:converter": "npm run -w packages/converter build",
|
||||
"build:schemas": "npm run -w packages/schemas build",
|
||||
|
||||
3
playground/.gitignore
vendored
3
playground/.gitignore
vendored
@@ -23,6 +23,7 @@ dist-ssr
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
test.pdf
|
||||
node-playground/test-generate.pdf
|
||||
node-playground/test-merge.pdf
|
||||
public/template-assets/**/thumbnail.png
|
||||
scripts/thumbnail-hash-map.json
|
||||
BIN
playground/node-playground/a.pdf
Normal file
BIN
playground/node-playground/a.pdf
Normal file
Binary file not shown.
BIN
playground/node-playground/b.pdf
Normal file
BIN
playground/node-playground/b.pdf
Normal file
Binary file not shown.
@@ -36,5 +36,5 @@ const inputs = [{ a: 'a1', b: 'b1', c: 'c1' }];
|
||||
|
||||
generate({ template, inputs }).then((pdf) => {
|
||||
console.log(pdf);
|
||||
fs.writeFileSync(path.join(__dirname, `test.pdf`), pdf);
|
||||
fs.writeFileSync(path.join(__dirname, `test-generate.pdf`), pdf);
|
||||
});
|
||||
11
playground/node-playground/merge.js
Normal file
11
playground/node-playground/merge.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const { merge } = require('@pdfme/manipulator');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const aPdf = fs.readFileSync(path.join(__dirname, 'a.pdf'));
|
||||
const bPdf = fs.readFileSync(path.join(__dirname, 'b.pdf'));
|
||||
|
||||
merge([aPdf, bPdf]).then((pdf) => {
|
||||
console.log(pdf);
|
||||
fs.writeFileSync(path.join(__dirname, `test-merge.pdf`), pdf);
|
||||
});
|
||||
@@ -19,6 +19,7 @@
|
||||
"@pdfme/generator": "file:../packages/generator/dist",
|
||||
"@pdfme/schemas": "file:../packages/schemas/dist",
|
||||
"@pdfme/ui": "file:../packages/ui/dist",
|
||||
"@pdfme/manipulator": "file:../packages/manipulator/dist",
|
||||
"canvas": "^2.11.2",
|
||||
"esbuild": "^0.19.10",
|
||||
"lucide-react": "^0.475.0",
|
||||
|
||||
Reference in New Issue
Block a user