Back to articles
The CMYK Problem Nobody Warns You About When Building a PDF Editor in the Browser

The CMYK Problem Nobody Warns You About When Building a PDF Editor in the Browser

via Dev.to WebdevManoj Vishwakarma

I spent three weeks building a browser-based PDF editor before I realized something was quietly wrong with every color in my application. I loaded a PDF with a specific shade of teal, defined in CMYK for print. It looked fine on the canvas. I picked that color with the eyedropper, applied it to some text, exported the PDF, and compared the output. The colors didn't match. Not dramatically off. Just enough to notice when you compared them side by side. That was the start of a rabbit hole I didn't expect. What Actually Happens When You Render a CMYK PDF in the Browser Most of us reach for pdf.js when we need to display PDFs in the browser. It works great. But here is something that is easy to miss: browsers only understand sRGB. They have no concept of CMYK color at all. So when pdf.js encounters a CMYK color value in a PDF, it converts it to RGB for rendering. That conversion is lossy. The RGB value it produces is an approximation, good enough for a screen preview, but it's not the orig

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
8 views

Related Articles