Skip to content

Instantly share code, notes, and snippets.

@iwong iwong/README.md
Last active Mar 19, 2019

Embed
What would you like to do?
wkhtmltopdf centos 7 headless with xvfb

wkhtmltopdf centos 7 headless with xvfb

Install and run standalone Xvfb

yum install xorg-x11-server-Xvfb
yum install xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi
wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm
rpm -ivh wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm

vim xvfb.service
cp xvfb.service /etc/systemd/system/xvfb.service
sudo systemctl enable xvfb.service
sudo systemctl start xvfb.service
sudo systemctl status xvfb.service

sudo systemctl daemon-reload

vim wkhtmltopdf.sh
chmod a+rx wkhtmltopdf.sh
./wkhtmltopdf.sh http://www.google.com output.pdf

Refs

xvfb-run -a -s "-screen 0 1024x768x24" wkhtmltopdf "$@"
[Unit]
Description=Virtual Frame Buffer X Server
After=network.target
[Service]
ExecStart=/usr/bin/Xvfb :42 -screen 0 1024x768x24 -ac +extension GLX +render -noreset
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.