Files
sam-docs/brochure/v5/convert-1page.cjs
김보곤 8e70987e42 docs: [brochure] v1~v9 브로슈어 SAM BI 브랜딩 통일
- (주)코드브릿지엑스 → SAM
- www.codebridge-x.com → www.sam.co.kr
- contact@codebridge-x.comcontact@sam.co.kr
- 푸터 문구 SAM — Smart Automation Management 통일
2026-03-03 18:58:37 +09:00

53 lines
1.9 KiB
JavaScript

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 = `<svg width="810" height="1440" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="bg" x1="0.087" y1="0" x2="-0.087" y2="1">
<stop offset="0%" stop-color="#0F172A"/>
<stop offset="55%" stop-color="#1E1B4B"/>
<stop offset="100%" stop-color="#312E81"/>
</linearGradient>
</defs>
<rect width="810" height="1440" fill="url(#bg)"/>
</svg>`;
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 htmlFile = path.join(__dirname, 'slides', 'brochure-dashboard-1page.html');
console.log('Converting CEO Dashboard v5 (Premium Gradient) 1-page brochure...');
try {
await html2pptx(htmlFile, pres);
} catch (err) {
console.error(`Error: ${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-1page.pptx');
await pres.writeFile({ fileName: outputPath });
console.log(`\nPPTX created: ${outputPath}`);
}
main().catch(console.error);