const path = require('path'); module.paths.unshift(path.join(require('os').homedir(), '.claude/skills/pptx-skill/scripts/node_modules')); const PptxGenJS = require('pptxgenjs'); const html2pptx = require(path.join(require('os').homedir(), '.claude/skills/pptx-skill/scripts/html2pptx.js')); const sharp = require('sharp'); async function generateGradientBg() { const svgGradient = ` `; const buf = await sharp(Buffer.from(svgGradient)).png().toBuffer(); return buf.toString('base64'); } async function main() { const pres = new PptxGenJS(); pres.defineLayout({ name: 'PORTRAIT_9x16', width: 5.625, height: 10 }); pres.layout = 'PORTRAIT_9x16'; // Pre-generate gradient background PNG console.log('Generating gradient background...'); const bgBase64 = await generateGradientBg(); const slidesDir = path.join(__dirname, 'slides'); const slides = ['brochure-dashboard-front.html', 'brochure-dashboard-back.html']; for (const file of slides) { const htmlFile = path.join(slidesDir, file); console.log(`Converting ${file} ...`); try { await html2pptx(htmlFile, pres); } catch (err) { console.error(`Error on ${file}: ${err.message}`); } } // Set gradient background on each slide for (const slide of pres.slides) { slide.background = { data: `image/png;base64,${bgBase64}` }; } const outputPath = path.join(__dirname, 'sam-brochure-v5-dashboard-2page.pptx'); await pres.writeFile({ fileName: outputPath }); console.log(`\nPPTX created: ${outputPath}`); } main().catch(console.error);