Add Watermark: ${isChecked('addWatermark')}
`;
if(document.getElementById('addWatermark').checked) imageSettings += `
Watermark Text: ${getValue('watermarkText')}
`;
summaryHtml += `
Image Settings
${imageSettings}`;
let videoSettings = `
Stabilization: ${stabilizationValue.textContent}
Color Grading: ${getValue('colorGrading')}%
Auto Captions: ${isChecked('aiCaptions')}
Add Intro/Outro: ${isChecked('addIntro')}
Add Music: ${isChecked('addMusic')}
`;
if(document.getElementById('addMusic').checked) videoSettings += `
Music Style: ${getSelectedText('musicStyle')}
`;
summaryHtml += `
Video Settings
${videoSettings}`;
summaryContent.innerHTML = summaryHtml;
};
downloadPdfBtn.addEventListener('click', () => {
if (!window.jspdf || !window.jspdf.jsPDF.autoTable) return;
const { jsPDF } = window.jspdf;
const doc = new jsPDF({ orientation: 'p', unit: 'pt', format: 'letter' });
const getValue = id => document.getElementById(id).value;
const getSelectedText = id => { const e = document.getElementById(id); return e.options[e.selectedIndex].text; };
const isChecked = id => document.getElementById(id).checked ? 'Yes' : 'No';
const page = { width: doc.internal.pageSize.getWidth(), margin: 72 };
let y = page.margin;
// PDF Content
doc.setFont('times', 'bold');
doc.setFontSize(22);
doc.text('Media Enhancement Profile', page.width / 2, y, { align: 'center' });
y += 40;
doc.setFont('times', 'normal');
doc.setFontSize(14);
doc.text(getValue('profileName'), page.width / 2, y, { align: 'center' });
y += 40;
// Image Settings Table
doc.setFont('times', 'bold');
doc.setFontSize(16);
doc.text('Image Enhancement Settings', page.margin, y);
y += 20;
const imageBody = [
['Brightness', `${getValue('brightness')}%`],
['Contrast', `${getValue('contrast')}%`],
['Sharpness', `${getValue('sharpness')}%`],
['AI Background Removal', isChecked('aiBgRemoval')],
['AI Color Correction', isChecked('aiColorCorrection')],
['Add Watermark', isChecked('addWatermark')],
];
if (document.getElementById('addWatermark').checked) {
imageBody.push(['Watermark Text', getValue('watermarkText')]);
}
doc.autoTable({
startY: y, head: [['Setting', 'Value']], body: imageBody, theme: 'grid',
headStyles: { fillColor: [124, 58, 237] }, styles: { font: 'times', fontSize: 10 }
});
y = doc.autoTable.previous.finalY + 30;
// Video Settings Table
doc.setFont('times', 'bold');
doc.setFontSize(16);
doc.text('Video Enhancement Settings', page.margin, y);
y += 20;
const videoBody = [
['Stabilization', stabilizationValue.textContent],
['Color Grading Intensity', `${getValue('colorGrading')}%`],
['Auto-generate Captions', isChecked('aiCaptions')],
['Add Standard Intro/Outro', isChecked('addIntro')],
['Apply Background Music', isChecked('addMusic')],
];
if (document.getElementById('addMusic').checked) {
videoBody.push(['Music Style', getSelectedText('musicStyle')]);
}
doc.autoTable({
startY: y, head: [['Setting', 'Value']], body: videoBody, theme: 'grid',
headStyles: { fillColor: [124, 58, 237] }, styles: { font: 'times', fontSize: 10 }
});
doc.save(`${getValue('profileName') || 'Enhancement-Profile'}.pdf`);
});
// --- Initial Setup ---
switchTab('setup');
});