diff --git a/bun.lockb b/bun.lockb index 4dcb909..0741acf 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 15e026f..46e0cf4 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "tsx": "^4.20.5" }, "dependencies": { - "pdf-lib": "^1.17.1" + "pdf-lib": "^1.17.1", + "pptxgenjs": "^4.0.1" } } diff --git a/skills/baoyu-slide-deck/scripts/merge-to-pdf.ts b/skills/baoyu-slide-deck/scripts/merge-to-pdf.ts index 6ba342c..5edccdc 100644 --- a/skills/baoyu-slide-deck/scripts/merge-to-pdf.ts +++ b/skills/baoyu-slide-deck/scripts/merge-to-pdf.ts @@ -73,8 +73,8 @@ async function createPdf(slides: SlideInfo[], outputPath: string) { for (const slide of slides) { const imageData = readFileSync(slide.path); - const ext = slide.filename.toLowerCase(); - const image = ext.endsWith(".png") + const isPng = imageData[0] === 0x89 && imageData[1] === 0x50 && imageData[2] === 0x4e && imageData[3] === 0x47; + const image = isPng ? await pdfDoc.embedPng(imageData) : await pdfDoc.embedJpg(imageData);