created a PoC for the client
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
|
||||
import PDFLib from 'pdf-lib';
|
||||
import { PDFDocument } from 'pdf-lib';
|
||||
|
||||
export const mergePDFs = async (snapshots) => {
|
||||
|
||||
const mergedPdf = await PDFLib.PDFDocument.create();
|
||||
const mergedPdf = await PDFDocument.create();
|
||||
|
||||
for (let i = 0; i < snapshots.length; i++) {
|
||||
const pdfToMerge = await PDFLib.PDFDocument.load(snapshots[i]);
|
||||
const pdfToMerge = await PDFDocument.load(snapshots[i]);
|
||||
|
||||
const copiedPages = await mergedPdf.copyPages(pdfToMerge, pdfToMerge.getPageIndices());
|
||||
copiedPages.forEach((page) => mergedPdf.addPage(page));
|
||||
|
||||
Reference in New Issue
Block a user