{"product_id":"test-kalkulator-acryl-aufsteller","title":"Test kalkulator Acryl Aufsteller","description":"\u003cdiv style=\"\n  height:2px;\n  background:#e5e5e5;\n  max-width:500px;\n  margin:20px auto;\n\"\u003e\u003c\/div\u003e\n\u003cscript src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jspdf\/2.5.1\/jspdf.umd.min.js\"\u003e\u003c\/script\u003e\n\n\u003cdiv style=\"text-align:center; margin:30px;\"\u003e\n  \u003cdiv style=\"margin-bottom:12px;\"\u003e\n    \u003clabel for=\"topRadiusFlat\" style=\"font-weight:600;\"\u003eRadius obere Ecken (mm)\u003c\/label\u003e\u003cbr\u003e\n    \u003cinput id=\"topRadiusFlat\" type=\"number\" value=\"0\" min=\"0\" style=\"padding:8px; max-width:160px;\"\u003e\n    \u003cp style=\"font-size:12px; color:#666; margin:6px 0 0;\"\u003e\n      Optional: Rundet nur die oberen beiden Ecken ab. Unten bleibt der Aufsteller gerade.\n    \u003c\/p\u003e\n  \u003c\/div\u003e\n\n  \u003cbutton id=\"generatePdfFlat\" type=\"button\" style=\"margin-bottom:4px;\"\u003e\n    Druckvorlage als PDF erstellen\n  \u003c\/button\u003e\n\n  \u003cp style=\"font-size:13px; color:#666; margin:0;\"\u003e\n    Inkl. 3 mm Beschnitt und 10 mm Sicherheitsabstand – Maßeingabe in mm\n  \u003c\/p\u003e\n\u003c\/div\u003e\n\n\u003cscript\u003e\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n\n  const button = document.getElementById(\"generatePdfFlat\");\n\n  button.addEventListener(\"click\", function () {\n\n    const widthInput = Array.from(document.querySelectorAll('[data-tpo-dimension=\"x\"]'))\n      .find(el =\u003e el.offsetParent !== null);\n\n    const heightInput = Array.from(document.querySelectorAll('[data-tpo-dimension=\"y\"]'))\n      .find(el =\u003e el.offsetParent !== null);\n\n    if (!widthInput || !heightInput) {\n      alert(\"Maßfelder nicht gefunden\");\n      return;\n    }\n\n    const widthMm = parseFloat(widthInput.value);\n    const heightMm = parseFloat(heightInput.value);\n\n    if (!widthMm || !heightMm || widthMm \u003c= 0 || heightMm \u003c= 0) {\n      alert(\"Bitte gültige Maße in mm eingeben.\");\n      return;\n    }\n\n    const bleed = 3;\n    const safe = 10;\n\n    const radiusInput = parseFloat(document.getElementById(\"topRadiusFlat\").value) || 0;\n    const radius = Math.max(0, Math.min(radiusInput, widthMm \/ 2, heightMm \/ 2));\n\n    const pageW = widthMm + bleed * 2;\n    const pageH = heightMm + bleed * 2;\n\n    const { jsPDF } = window.jspdf;\n\n    const pdf = new jsPDF({\n      orientation: pageW \u003e pageH ? \"landscape\" : \"portrait\",\n      unit: \"mm\",\n      format: [pageW, pageH]\n    });\n\n    function drawTopRoundedRect(pdf, x, y, w, h, r) {\n      if (r \u003c= 0) {\n        pdf.rect(x, y, w, h);\n        return;\n      }\n\n      const c = r * 0.5522847498;\n\n      pdf.lines([\n        [w - 2 * r, 0],\n        [c, 0, r, r - c, r, r],\n        [0, h - r],\n        [-w, 0],\n        [0, -(h - r)],\n        [0, -c, r - c, -r, r, -r]\n      ], x + r, y, [1, 1], \"S\", true);\n    }\n\n    \/* ROT = Beschnitt *\/\n    pdf.setDrawColor(255, 0, 0);\n    pdf.setLineWidth(0.25);\n    pdf.setLineDashPattern([2, 2], 0);\n    pdf.rect(0, 0, pageW, pageH);\n\n    \/* GRÜN = Endformat *\/\n    pdf.setLineDashPattern([], 0);\n    pdf.setDrawColor(0, 150, 0);\n    pdf.setLineWidth(0.45);\n\n    drawTopRoundedRect(pdf, bleed, bleed, widthMm, heightMm, radius);\n\n    \/* BLAU = Sicherheitsabstand *\/\n    pdf.setDrawColor(0, 100, 255);\n    pdf.setLineWidth(0.3);\n    pdf.setLineDashPattern([2, 2], 0);\n\n    if (widthMm \u003e safe * 2 \u0026\u0026 heightMm \u003e safe * 2) {\n      pdf.rect(\n        bleed + safe,\n        bleed + safe,\n        widthMm - safe * 2,\n        heightMm - safe * 2\n      );\n    }\n\n    pdf.setLineDashPattern([], 0);\n\n    pdf.setFont(undefined, \"bold\");\n    pdf.setTextColor(40, 40, 40);\n\n    pdf.setFontSize(18);\n    pdf.text(\"VIS24 Druckvorlage\", pageW \/ 2, pageH \/ 2 - 15, { align: \"center\" });\n\n    pdf.setFontSize(12);\n    pdf.text(\n      Math.round(widthMm) + \" x \" + Math.round(heightMm) + \" mm\",\n      pageW \/ 2,\n      pageH \/ 2,\n      { align: \"center\" }\n    );\n\n    pdf.setFontSize(9);\n\nlet legendY = bleed + safe + (heightMm - safe * 2) - 20;\n\npdf.setTextColor(255, 0, 0);\n\npdf.text(\n\n  \"ROT: Beschnitt 3 mm\",\n\n  pageW \/ 2,\n\n  legendY,\n\n  { align: \"center\" }\n\n);\n\nlegendY += 5;\n\npdf.setTextColor(0, 150, 0);\n\npdf.text(\n\n  \"GRÜN: Endformat\",\n\n  pageW \/ 2,\n\n  legendY,\n\n  { align: \"center\" }\n\n);\n\nlegendY += 5;\n\npdf.setTextColor(0, 100, 255);\n\npdf.text(\n\n  \"BLAU: Sicherheitsabstand 10 mm\",\n\n  pageW \/ 2,\n\n  legendY,\n\n  { align: \"center\" }\n\n);\n\n    pdf.save(\n      \"VIS24_Acrylglas_Aufsteller_\" +\n      Math.round(widthMm) +\n      \"x\" +\n      Math.round(heightMm) +\n      \"mm.pdf\"\n    );\n\n  });\n\n});\n\u003c\/script\u003e\n\u003cdiv style=\"\n  height:2px;\n  background:#e5e5e5;\n  max-width:500px;\n  margin:20px auto;\n\"\u003e\u003c\/div\u003e","brand":"VIS24","offers":[{"title":"Default Title","offer_id":57149024436489,"sku":null,"price":0.0,"currency_code":"EUR","in_stock":false}],"url":"https:\/\/vis24.de\/products\/test-kalkulator-acryl-aufsteller","provider":"VIS24","version":"1.0","type":"link"}