In my project I am trying to print a PDF in Greyscale with a couple of images and text from HTML using the wicked_PDF. The Gem provides a function for the same, but it doesn’t seem to be working.
Here is my code:
render :pdf => "MyObject",
:wkhtmltopdf => '/usr/local/bin/wkhtmltopdf',
:template => '/widgets/pdf/show_myObject.erb',
:page_size => 'A4',
:header => { :html => { :template => "/widgets/pdf/myObject_header.erb" }},
:footer => { :html => { :template => "/widgets/pdf/myObject_footer.erb" }, :line => true },
:margin => { :top => 0, :left => 3, :right => 3 },
:greyscale => true
I am passing the images as background. But it renders in color. Am I missing something? Why is wicked_PDF gem unable to process greyscale function as expected?
Their documentation did not have any help regarding this.
Turns out the wkhtmltopdf
--grayscaleoption was incorrectly coded in wicked_pdf as--greyscale(swap the ‘e’ for an ‘a’).
I’ve pushed a fix, and cut a new version of the gem (0.7.9) for this. Thanks for pointing it out!
Now works as intended.