diff --git a/index.html b/index.html index cc30d8d..b061ebf 100644 --- a/index.html +++ b/index.html @@ -1344,17 +1344,18 @@ pageIssues.forEach((issue, index) => { const coords = issue.coordinates; - // Scale PDF coordinates to image pixels - // PDF coordinates are bottom-left origin, need to flip Y and scale + // Scale coordinates from PDF points to image pixels + // pdfplumber uses top-left origin (0,0 = top-left), same as SVG + // So NO Y-flipping needed, just scale! const x0 = coords.x0 * scaleFactor; + const y0 = coords.y0 * scaleFactor; // coords.y0 is 'top' from pdfplumber const x1 = coords.x1 * scaleFactor; - const y0 = imgHeight - (coords.y1 * scaleFactor); // Flip Y - const y1 = imgHeight - (coords.y0 * scaleFactor); // Flip Y + const y1 = coords.y1 * scaleFactor; // coords.y1 is 'bottom' from pdfplumber const width = x1 - x0; const height = y1 - y0; - console.log(`Issue ${index + 1}: PDF coords (${coords.x0}, ${coords.y0}) → Screen (${x0.toFixed(0)}, ${y0.toFixed(0)}), size: ${width.toFixed(0)}x${height.toFixed(0)}`); + console.log(`Issue ${index + 1}: PDF (${coords.x0}, ${coords.y0}, ${coords.x1}, ${coords.y1}) → Pixels (${x0.toFixed(0)}, ${y0.toFixed(0)}, ${x1.toFixed(0)}, ${y1.toFixed(0)}), size: ${width.toFixed(0)}x${height.toFixed(0)}`); // Color based on severity let strokeColor, fillColor;