created a PoC for the client

This commit is contained in:
Saud Fatayerji
2023-10-26 23:41:48 +03:00
parent 13c4f664c2
commit 6d505715e0
16 changed files with 168 additions and 90 deletions

View File

@@ -1,5 +1,5 @@
import PDFLib from 'pdf-lib';
import { PDFDocument } from 'pdf-lib';
/**
* @typedef {"CUSTOM_PAGE_ORDER"|"REVERSE_ORDER"|"DUPLEX_SORT"|"BOOKLET_SORT"|"ODD_EVEN_SPLIT"|"REMOVE_FIRST"|"REMOVE_LAST"|"REMOVE_FIRST_AND_LAST"} OrderOperation
@@ -14,8 +14,8 @@ import PDFLib from 'pdf-lib';
* @returns
*/
export async function organizePages(snapshot, operation, customOrderString) {
const pdfDoc = await PDFLib.PDFDocument.load(snapshot);
let subDocument = await PDFLib.PDFDocument.create();
const pdfDoc = await PDFDocument.load(snapshot);
let subDocument = await PDFDocument.create();
const copiedPages = await subDocument.copyPages(pdfDoc, pdfDoc.getPageIndices());