Open nicorsm opened 1 month ago
Upon checking the PR, it became clear that only the text, line, rectangle, and ellipse schemas support CMYK.
To add CMYK support for QR codes as well, modifications to the barcode schema will be necessary.
Whilst CMYK colours can be passed to bwip-js, apparently it converts to RGB anyway internally. This might be difficult to achieve...
@peteward Thank you for investigating
umm... It might be possible to achieve this by adding a process to convert the image data from RGB to CMYK before embedding it into pdf-lib.
The first step would probably be to do the conversion to CMYK for barcode color values as input for bwip to confirm if this does or does not work, then decide if post-conversion of images is something we can or should do
@nicorsm Can we assign this task to you? If you have any questions, I'd love to answer and help.
Hi @hand-dot, right now I'm not that familiar with the codebase of this library and with React, so I believe it's better to assign the task to someone else. I'll try anyway to look into this issue in the upcoming weeks as I want to understand better how the library works.
Describe the bug
TL;DR: when rendering documents as CMYK with the
colorType: cmyk
option, the QR codes inside them are rendered as RGB.I'm trying to export a series of QR codes by using a template containing placeholders for a QR code, which has been created with the Template Designer at pdfme.com starting from a CMYK file. I'm also setting the
colorType
option tocmyk
. Everything looks good, however, when opening the output PDF file in Illustrator, a popup opens saying that the document has mixed RGB and CMYK content. I dag deeper by opening the document in Acrobat Pro and running the printing Preflight tool, and I found that, while the whole content is correctly rendered as CMYK, the QR code is rendered as RGB.To Reproduce
Sample code can be found here, together with a sample
output.pdf
file and the JSON of the template: https://github.com/nicorsm/pdfme-cmyk-issue After installing the dependencies, you can runnode index.js
.Expected behavior
I would expect the QR code to be rendered as CMYK, same as the whole document.
Your Environment
Your Error Log
Additional context
This issue has to do with the introduction of
colorType
option described here: https://github.com/pdfme/pdfme/pull/436