I'm using Terrapin to execute wkhtmltopdf from command line inside Rails.
Terrapin::CommandLine.path = "/usr/bin/wkhtmltopdf"pdfCommand = Terrapin::CommandLine.new("xvfb-run wkhtmltopdf :html_source :pdf_target")tempHTML = Tempfile.new(["pattern", ".html"])tempHTML << htmltempPDF = Tempfile.new(["pattern",".pdf"])pdfCommand.run(html_source: tempHTML.path, pdf_target: tempPDF.path)
It runs, but returns:
QPainter::begin(): Returned falseError: Unable to write to destinationExit with code 1, due to unknown error.
I've made sure wkhtmltopdf has full permissions, I'm not sure if maybe Terrapin has something to do with this?
Edit: running xvfb-run wkhtmltopdf http://www.example.com test.pdf
in console works as expected.