feat(now supports pdf -> jpg): update
This commit is contained in:
10
test/test.ts
10
test/test.ts
@ -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();
|
||||
});
|
||||
|
Reference in New Issue
Block a user