`;
}
// --- Download & PDF ---
function downloadHtmlFile() {
if (!generatedHtml) return;
const blob = new Blob([generatedHtml], { type: 'text/html' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'landing-page.html';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}
function generatePdf() {
if (!generatedHtml) return;
const { jsPDF } = window.jspdf;
const doc = new jsPDF();
const inputs = getInputs();
doc.setFont('helvetica', 'bold');
doc.setFontSize(18);
doc.text('AI Landing Page Generation Report', doc.internal.pageSize.getWidth() / 2, 20, { align: 'center' });
doc.autoTable({
startY: 30,
head: [['Parameter', 'User Input']],
body: [
['Product Name', inputs.productName],
['Target Audience', inputs.audience],
['Key Features', inputs.features.replace(/\n/g, ', ')],
['Call to Action', inputs.cta],
['Tone & Style', inputs.tone],
],
theme: 'striped',
headStyles: { fillColor: '#2563eb' },
});
doc.setFont('helvetica', 'normal');
doc.setFontSize(10);
doc.setTextColor(150);
const finalY = doc.autoTable.previous.finalY;
doc.text('The generated HTML file is available as a separate download.', 14, finalY + 10);
doc.save('landing-page-report.pdf');
}
});
