Stirling-PDF/shared-operations/functions/extractPages.ts
Felix Kaspar 97e4eab7bb Cleaned the server-node dir
Split express into different ports for easier migration
Typed page ops that had warnings
2023-11-08 02:24:16 +01:00

11 lines
429 B
TypeScript

import { PDFDocument } from 'pdf-lib';
import { createSubDocument } from './common/createSubDocument';
export async function extractPages(snapshot: string | Uint8Array | ArrayBuffer, pagesToExtractArray: number[]): Promise<Uint8Array>{
const pdfDoc = await PDFDocument.load(snapshot)
// TODO: invent a better format for pagesToExtractArray and convert it.
return createSubDocument(pdfDoc, pagesToExtractArray);
};