Ich verwende: < /p>
- html2canvas für PDF -Generation < /li>
JSPDF zum Speichern der PDF - Lucide React Icons
- Rashwind -CSS zum Styling
Hier ist der entsprechende Code. : < /p>
Code: Select all
// PDF Generation
const generatePDF = async () => {
const content = contentRef.current;
const canvas = await html2canvas(content, {
scale: 2,
useCORS: true,
logging: false
});
const imgData = canvas.toDataURL('image/png');
const pdf = new jsPDF({
orientation: 'portrait',
unit: 'px',
format: [canvas.width, canvas.height]
});
pdf.addImage(imgData, 'PNG', 0, 0, canvas.width, canvas.height);
pdf.save('resume.pdf');
};
// Icon usage in template
{email}