mirror of
https://github.com/pdfme/pdfme.git
synced 2026-05-24 14:46:11 -04:00
15 lines
482 B
JavaScript
15 lines
482 B
JavaScript
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { merge } from '@pdfme/manipulator';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
const aPdf = fs.readFileSync(path.join(__dirname, 'a.pdf'));
|
|
const bPdf = fs.readFileSync(path.join(__dirname, 'b.pdf'));
|
|
|
|
const pdf = await merge([aPdf, bPdf]);
|
|
console.log(pdf);
|
|
fs.writeFileSync(path.join(__dirname, 'test-merge.pdf'), pdf);
|