Skip to content

Instantly share code, notes, and snippets.

@oldskool
Created April 20, 2015 15:00
Show Gist options
  • Select an option

  • Save oldskool/fe923eb2a1555136d1ec to your computer and use it in GitHub Desktop.

Select an option

Save oldskool/fe923eb2a1555136d1ec to your computer and use it in GitHub Desktop.
WkHtmlToPdf 64-bit binary wrapper for VMs without X install
#!/bin/bash
# Script requires xvfb-run command (provided by xorg-x11-server-Xvfb package)
# Require exactly two arguments (input and output file)
if [ $# -ne 2 ]; then
echo "Syntax: $0 <input file> <output file>"
exit 1
fi
xvfb-run --server-args="-screen 0, 1280x1024x24" /usr/bin/wkhtmltopdf-amd64 --use-xserver $1 $2
@oldskool

Copy link
Copy Markdown
Author

Move the original binary to /usr/bin/wkhtmltopdf-amd64 and save this script as /usr/bin/wkhtmltopdf. Then just the plain wkhtmltopdf command will also work on servers/VMs without X install present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment