Stirling-PDF/shared-operations/functions/extractPages.js

11 lines
357 B
JavaScript
Raw Normal View History

2023-10-26 20:53:02 +02:00
2023-10-26 22:41:48 +02:00
import { PDFDocument } from 'pdf-lib';
import { createSubDocument } from './createSubDocument';
2023-10-26 20:53:02 +02:00
export async function extractPages(snapshot, pagesToExtractArray) {
2023-10-26 22:41:48 +02:00
const pdfDoc = await PDFDocument.load(snapshot)
2023-10-17 03:40:54 +02:00
// TODO: invent a better format for pagesToExtractArray and convert it.
2023-10-26 20:53:02 +02:00
return createSubDocument(pdfDoc, pagesToExtractArray);
2023-10-17 03:40:54 +02:00
};