Initialer Commit von lokal
This commit is contained in:
+46
@@ -0,0 +1,46 @@
|
||||
// util/pdf.js
|
||||
|
||||
async function generatePDF(url, violations, note, screenshotDataUrl) {
|
||||
const { jsPDF } = window.jspdf;
|
||||
const doc = new jsPDF();
|
||||
|
||||
let y = 10;
|
||||
|
||||
doc.setFontSize(16);
|
||||
doc.text("Cookie-Banner Verstoßmeldung", 10, y);
|
||||
y += 10;
|
||||
|
||||
doc.setFontSize(12);
|
||||
doc.text(`Datum: ${new Date().toLocaleString()}`, 10, y);
|
||||
y += 10;
|
||||
|
||||
doc.text(`URL:`, 10, y);
|
||||
doc.text(url, 30, y);
|
||||
y += 10;
|
||||
|
||||
doc.text("Verstöße:", 10, y);
|
||||
violations.forEach(v => {
|
||||
y += 7;
|
||||
doc.text(`- ${v}`, 15, y);
|
||||
});
|
||||
|
||||
y += 10;
|
||||
doc.text("Zusätzliche Hinweise:", 10, y);
|
||||
y += 7;
|
||||
const splitNote = doc.splitTextToSize(note || "Keine Angabe", 180);
|
||||
doc.text(splitNote, 10, y);
|
||||
y += splitNote.length * 7;
|
||||
|
||||
if (screenshotDataUrl) {
|
||||
y += 10;
|
||||
doc.text("Screenshot:", 10, y);
|
||||
y += 5;
|
||||
try {
|
||||
doc.addImage(screenshotDataUrl, 'PNG', 10, y, 180, 100);
|
||||
} catch (error) {
|
||||
console.error("Fehler beim Einfügen des Screenshots ins PDF:", error);
|
||||
}
|
||||
}
|
||||
|
||||
doc.save('cookiekop_meldung.pdf');
|
||||
}
|
||||
Reference in New Issue
Block a user