From c4e9aed3f15ddfee1fd1a40667dc1bd068668bb3 Mon Sep 17 00:00:00 2001 From: "Hans K. Nielsen" Date: Thu, 21 Apr 2016 22:15:31 +0200 Subject: [PATCH 1/2] Update readme.md --- readme.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/readme.md b/readme.md index 350266e..c0251e6 100644 --- a/readme.md +++ b/readme.md @@ -34,6 +34,21 @@ You can optionally use the facade for shorter code. Add this to your facades: You can publish the config-file to change some settings (default paper etc). php artisan vendor:publish + +#### Homestead + +If you are using homestead for your Laravel development you might have the problem that the shipped version of wkhtmltopdf for Ubuntu is compiled with the need for an installed x-server. + +However to avoid installing a complet x-server in your Homestead enviroment you could use xvfb (X virtual framebuffer). + +Steps to setup wkhtmltopdf in Homestead with xvfb: + +1. apt-get install wkhtmltopdf +2. apt-get install xvfb +3. echo -e '#!/bin/bash\nxvfb-run -a --server-args="-screen 0, 1920x1080x24" /usr/bin/wkhtmltopdf -q $*' > /usr/bin/wkhtmltopdf.sh; chmod a+x /usr/bin/wkhtmltopdf.sh; ln -s /usr/bin/wkhtmltopdf.sh /usr/local/bin/wkhtmltopdf +4. Test out making a PDF file: wkhtmltopdf http://www.google.com google.pdf + +This should now allow you to use wkhtmltopdf in Homestead without installing a complete x-server. ### Lumen In `bootstrap/app.php` add: From 9c4a957d3d64e01ae22ff57fde20bd11f48f871b Mon Sep 17 00:00:00 2001 From: "Hans K. Nielsen" Date: Thu, 21 Apr 2016 22:22:00 +0200 Subject: [PATCH 2/2] Added info about using laravel-snappy in Homestead --- readme.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index c0251e6..4e5a022 100644 --- a/readme.md +++ b/readme.md @@ -43,12 +43,12 @@ However to avoid installing a complet x-server in your Homestead enviroment you Steps to setup wkhtmltopdf in Homestead with xvfb: -1. apt-get install wkhtmltopdf -2. apt-get install xvfb -3. echo -e '#!/bin/bash\nxvfb-run -a --server-args="-screen 0, 1920x1080x24" /usr/bin/wkhtmltopdf -q $*' > /usr/bin/wkhtmltopdf.sh; chmod a+x /usr/bin/wkhtmltopdf.sh; ln -s /usr/bin/wkhtmltopdf.sh /usr/local/bin/wkhtmltopdf -4. Test out making a PDF file: wkhtmltopdf http://www.google.com google.pdf +1. `apt-get install wkhtmltopdf` +2. `apt-get install xvfb` +3. `echo -e '#!/bin/bash\nxvfb-run -a --server-args="-screen 0, 1920x1080x24" /usr/bin/wkhtmltopdf -q $*' > /usr/bin/wkhtmltopdf.sh; chmod a+x /usr/bin/wkhtmltopdf.sh; ln -s /usr/bin/wkhtmltopdf.sh /usr/local/bin/wkhtmltopdf` +4. Test out making a PDF file: `wkhtmltopdf https://www.google.com google.pdf` (This should leave you with a PDF file of the google frontpage). -This should now allow you to use wkhtmltopdf in Homestead without installing a complete x-server. +You should now be able to use wkhtmltopdf/laravel-snappy in Homestead without installing a complete x-server. ### Lumen In `bootstrap/app.php` add: