So after dredging multiple sites apparently the packaged version of wkhtmltopdf for my distro is insufficient for mydbr when there is no X server installed.
eellis@mymachine:~$ wkhtmltopdf http://google.com google.pdf wkhtmltopdf: cannot connect to X server
When trying to run the output of a mydbr error, I get more interesting output:
eellis@mymachine:~$ wkhtmltopdf -q --header-html http://mymachine.lan/user/export_header_pdf.php --margin-top 20 --header-spacing 8 /tmp/464971164.html -
The switch --header-html, is not support using unpatched qt, and will be ignored.The switch --header-spacing, is not support using unpatched qt, and will be ignored.wkhtmltopdf: cannot connect to X server
Huh.. what's that referencing? Let's check:
eellis@mymachine:~$ wkhtmltopdf --help
Name:
wkhtmltopdf 0.9.9
Synopsis: wkhtmltopdf [OPTIONS]... <input file> [More input files] <output file>
Description: Converts one or more HTML pages into a PDF document, *not* using wkhtmltopdf patched qt.
General Options: --collate Collate when printing multiple copies --copies <number> Number of copies to print into the pdf file (default 1) --extended-help Display more extensive help, detailing less common command switches -h, --help Display help -O, --orientation <orientation> Set orientation to Landscape or Portrait -s, --page-size <size> Set paper size to: A4, Letter, etc. --password <password> HTTP Authentication password -p, --proxy <proxy> Use a proxy -q, --quiet Be less verbose --username <username> HTTP Authentication username -V, --version Output version information an exit
Reduced Functionality: This version of wkhtmltopdf has been compiled against a version of QT without the wkhtmltopdf patches. Therefore some features are missing, if you need these features please use the static version.
Currently the list of features only supported with patch QT includes:
* Printing more then one HTML document into a PDF file. * Running without an X11 server. * Adding a document outline to the PDF file. * Adding headers and footers to the PDF file. * Generating a table of contents. * Adding links in the generated PDF file. * Printing using the screen media-type. * Disabling the smart shrink feature of webkit.
Contact: If you experience bugs or want to request new features please visit <http://code.google.com/p/wkhtmltopdf/issues/list>, if you have any problems or comments please feel free to contact me: see <http://www.madalgo.au.dk/~jakobt/#about>
We run all of our webservers headless, and are very comfortable with the command line, so the X server requirement is pretty disappointing.
I have found a method to compile a QT linked version of wkhtmltopdf (which appears to be the requirement) on my distro at (https://gist.github.com/Zauberfisch/8773593), but it requires an absurd amount of stuff to be installed, an X server among others. I will probably have a build machine specifically for this and see if I can get that to work so I can distribute the resulting binary to all of my production machines.
In version 4, there doesn't appear to be a way to remove the option for PDF exports from the menu list that I've seen. If there is, can I get a link to the pertinent documentation?
Might I suggest that some thought be given to tcpdf as a potential replacement for wkhtmltopdf? I apologize if it has already been considered and dismissed, but more options (and potentially this could be distributed with the mydbr code) would be welcome.
Thanks for your time.