feat(now supports pdf -> jpg): update

This commit is contained in:
2024-04-25 18:48:08 +02:00
parent fe6be928a9
commit d157a3acd9
6 changed files with 906 additions and 489 deletions

View File

@ -43,16 +43,22 @@ tap.test('should create a valid PDFResult', async () => {
await writePDfToDisk('https://layer.io', '2.pdf');
});
tap.test('should combine pdfs', async () => {
tap.test('should merge pdfs', async () => {
const fs = await import('fs');
const pdf1 = await testSmartPdf.readFileToPdfObject('.nogit/1.pdf');
const pdf2 = await testSmartPdf.readFileToPdfObject('.nogit/2.pdf');
fs.writeFileSync(
`.nogit/combined.pdf`,
(await testSmartPdf.mergePdfs([pdf1, pdf2])).buffer as Buffer
await testSmartPdf.mergePdfs([pdf1.buffer, pdf2.buffer])
);
});
tap.test('should create images from an pdf', async () => {
const pdfObject = await testSmartPdf.readFileToPdfObject('.nogit/combined.pdf');
const images = await testSmartPdf.convertPDFToJPGBytes(pdfObject.buffer);
console.log(images);
});
tap.test('should be able to close properly', async () => {
await testSmartPdf.stop();
});