Fix blurry PDF text on mobile Safari by accounting for devicePixelRatio#227
Fix blurry PDF text on mobile Safari by accounting for devicePixelRatio#227
Conversation
Canvas was rendered at CSS pixel dimensions, causing blurry upscaling on high-DPI screens (mobile Safari typically has devicePixelRatio of 2-3). Now renders at native device resolution and uses CSS to scale the canvas element back to logical size. https://claude.ai/code/session_01YcR4QgziQReqarBy3HuxcH
|
Claude finished @simonw's task —— View job PR Review Complete ✅I've reviewed the PDF mobile blur fix. Here's my comprehensive feedback:
Code Quality & Implementation ✅Excellent approach. The fix correctly addresses the high-DPI canvas rendering issue by:
This is the standard solution for crisp canvas rendering on high-DPI displays. Technical ReviewLines 317-323 ( const dpr = window.devicePixelRatio || 1;
canvas.width = Math.floor(viewport.width * dpr);
canvas.height = Math.floor(viewport.height * dpr);
canvas.style.width = viewport.width + 'px';
canvas.style.height = viewport.height + 'px';
context.scale(dpr, dpr);Strengths:
Potential Issues & ImprovementsMinor Edge Cases:
Performance Impact: 📈
Security Assessment ✅No security concerns. The change only affects canvas rendering dimensions and doesn't introduce any new attack vectors. Test Coverage ConsiderationsThe change affects visual rendering quality, which is difficult to unit test. Consider:
Recommendation: APPROVE ✅This is a well-implemented fix for a common high-DPI canvas issue. The code follows best practices and the performance trade-offs are reasonable for the visual quality improvement gained. Suggested follow-up (optional): Consider adding a comment explaining the DPR scaling for future maintainers. |
Deploying tools with
|
| Latest commit: |
a429fb8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://765e103e.tools-b1q.pages.dev |
| Branch Preview URL: | https://claude-fix-pdf-mobile-blur-t.tools-b1q.pages.dev |


Canvas was rendered at CSS pixel dimensions, causing blurry upscaling on
high-DPI screens (mobile Safari typically has devicePixelRatio of 2-3).
Now renders at native device resolution and uses CSS to scale the canvas
element back to logical size.
https://claude.ai/code/session_01YcR4QgziQReqarBy3HuxcH