Closed robzolkos closed 10 years ago
Hi Rob,
Thanks for the report. When I open the sample pdf on my system (in evince and Acrobat X) it has a yellow heading, white type and a black background. Is that correct?
Unfortunately I don't have illustrator handy at the moment, but I'd like to clarify the issue first.
What you are seeing in evince and Acrobat X is correct. I have attached a screenshot of what is looks like when opened in Illustrator.
Did we ever sort out what this issue was?
No. And still ocurrs.
On Tuesday, March 18, 2014, Gregory Brown notifications@github.com wrote:
Did we ever sort out what this issue was?
Reply to this email directly or view it on GitHubhttps://github.com/prawnpdf/prawn/issues/359#issuecomment-37871527 .
thanks, Rob
@robzolkos: If you can restore your bug example repo, we can take a closer look. Just to confirm, you've reproduced the problem on Prawn 1.0.0 (just released last night)?
I'm seeing the exact same issue, but with completely different tools, so I don't think the issue is specifically related to prawn.
I'm converting a RGB jpg to CMYK using imagemagick, then inserting the image in a PDF using the Node.js pdfkit library.
Just like on your end, the PDF looks ok in all PDF readers (evice, okular, acrobat, etc.), but the image colors are inverted when opened in Illustrator.
Have you found any work-around?
Seems that, at least on my end, I've managed to find a work-around for the issue, by using the -interlace
flag, when converting the image to CMYK with ImageMagick, making a progressive jpeg.
An example showing the issue is here: https://github.com/robzolkos/prawn-issue
hello.pdf is the generated pdf. Opening in Illustrator the colors are inverted.
Don't worry people, its simply that your RGB PDF is being automatically converted to CMYK witch creates that bug. Follow those steps and you should be OK.
Like magic, your issue is no more !
@Screwface What if we want our PDF to be in CMYK, though?
I would propose to re-open this issue. I don't believe it is fixed, and the workaround is not a tenable one.
In short: When opening a prawn-generated CMYK PDF in illustrator with embedded JPGs that are also in CMYK, the embedded JPGs colors are inverted.
@elsurudo Have you tried PDFs generated with other applications if they exhibit the same issue? E.g. creating a PDF from a LibreOffice Writer document that contains a CMYK JPG? @ghinda said that the same problem applies to other libraries too, so maybe it is something on Illustrator's side...
I had the same problem with CMYK PDFs generated with TCPDF or FPDF. They look fine in Acrobat Reader, Photoshop, etc. However, Illustrator shows them inverted. I found a solution:
/Decode [0 1 0 1 0 1 0 1]
is used instead of
/Decode [1 0 1 0 1 0 1 0]
Illustrator obviously ignores this string. Other PDF readers will invert the inverted CMYK back (basically).
This is how I did it:
Open the pdf file in Acrobat Pro, choose “Edit PDF”, do any minor changes, then save the file.
Now the pdf should appear in correct colors in other Adobe softwares.
Hey @teambuktu,
I really like your workaround. Hopefully, it'd save my ass on a project. Could you please clarify the "Change the source code (in your PDF library), so that" part regarding to an embedded image with jsPDF?
Thanks a lot, Aron
Hey @teambuktu,
I really like your workaround. Hopefully, it'd save my ass on a project. Could you please clarify the "Change the source code (in your PDF library), so that" part regarding to an embedded image with jsPDF?
Thanks a lot, Aron
I'm not sure about jsPDF. After generating your PDF open it in a text viewer and try to do a full text search for "CMYK" and locate a line like this:
<</Type /XObject /Subtype /Image /Width 2929 /Height 1535 /ColorSpace /DeviceCMYK /Decode [0 1 0 1 0 1 0 1] /BitsPerComponent 8 /Filter /DCTDecode /Length 70659 >> stream
If the bits behind decode are not in this order, it seems to cause problems. That's why I inverted the CMYK jpeg and made sure the Decode value is [0 1 0 1 0 1 0 1]
Now you would have to find out the function in the source code that generates this Decode-String. It might have something to do with the line "options.push({ key: "Decode", value: "[0.0 1.0 0.0 1.0 0.0 1.0]" });" in https://github.com/MrRio/jsPDF/blob/master/src/jspdf.js
But that's just a quick guess, which might be wrong.
I hope I could give you a first clue.
I have produced a CMYK PDF using prawn. The background image I used is a cmyk jpg and then apply prawns text commands to it. When I open the PDF in any application it looks correct. However opening it in Adobe Illustrator, the background has inverted colors.
I am not sure what is causing this or how to resolve. But I need to be able to open the PDF generated by prawn and edit it in Illustrator. Hopefully someone has heard of this happening and knows a fix.
Ive put an example PDF in this repo https://github.com/RobZolkos/pdfissue