Comments (13)
Just to be clear, my linked comment above was just providing support to someone that was knowingly performing config changes outside of what BookStack supports. None of the /config
files are intended to be altered by end-users, and custom changes to these are not supported by BookStack itself.
from docker-bookstack.
This bin is mainlined in Alpine:
https://pkgs.alpinelinux.org/packages?name=wkhtmltopdf&branch=edge&repo=community
you can just install this and set it in your env:
https://www.bookstackapp.com/docs/admin/pdf-rendering/
Add this script to your /config/custom-cont-init.d/install-wkhtmltopdf.sh
#! /bin/bash
# install wkhtmltopdf if it is not installed
if [ ! -f /usr/bin/wkhtmltopdf ]; then
apk add \
--no-cache \
-X http://dl-cdn.alpinelinux.org/alpine/edge/community \
wkhtmltopdf
fi
from docker-bookstack.
It works partially, wkhtmltopdf gets installed but I'm getting this error now.
[2019-06-02 22:24:57] production.ERROR: The process has been signaled with signal "6". {"exception":"[object] (Symfony\\Component\\Process\\Exception\\RuntimeException(code: 0): The process has been signaled with signal \"6\". at /var/www/html/vendor/symfony/process/Process.php:431)
I can provide the full laravel.log if needed.
During the debugging process I found out that it would be useful if the /var/www/html/config
directory would be linked to the outside of the container.
In ordner to customize the PDF output one has to edit the snappy.php file in that directory.
That's btw the file which reads the WKHTMLTOPDF variable from the .env
file.
A huge thank you by the way for the quick reaction!
from docker-bookstack.
@Nebucatnetzer Have you got any links to the Bookstack upstream stuff about wkhtmltopdf
I can understand moving .env
files out but moving the core php
files out into /config
will break future updates potentially.
from docker-bookstack.
OK, reading the docs.
https://www.bookstackapp.com/docs/admin/pdf-rendering/
You need to manually edit /config/www/.env
to include the line.
WKHTMLTOPDF=/usr/bin/wkhtmltopdf
from docker-bookstack.
@Nebucatnetzer Have you got any links to the Bookstack upstream stuff about
wkhtmltopdf
I can understand moving.env
files out but moving the corephp
files out into/config
will break future updates potentially.
The part that I mean can be found here:
BookStackApp/BookStack#992 (comment)
I know that's not ideal, I'll check with the developer if it's possible to move those variables out of the snapp.php file.
I'm customizing page width, etc. in that file.
I'm aware that you define the binary path in the .env file.
While this does get picked up by Bookstack it gives me the above error when I try to use wkhtmltopdf.
from docker-bookstack.
I will put this on a todo list, I cannot promise a time frame
from docker-bookstack.
@ssddanbrown makes sense and wasn't really understood as such :).
Do you have any plans for the PDF export? Supported options, better defaults, other things?
Does it make sense to have this issue here or do we need an additional one on the bookstack repo?
To me it could be two issues, one here to get the wkthmltopdf binary working and another one over @BookStack for the config options in the .env file.
from docker-bookstack.
Well if it's not supported upstream then we shouldn't be supporting it either.
I can think of ways around it that I'm happy to explain, but it would be with the understanding that it forfeits any support from us and may cause issues when Bookstack gets updates.
from docker-bookstack.
wkhtmltopdf is supported by Bookstack. What isn't supported is customisation of it's output.
At least that's my understanding of it being mentioned in the documentation and having a variable in the .env file for the binary path.
from docker-bookstack.
@Nebucatnetzer Just been playing about with this. Took a while of trial and error but have had luck with the below set as the contents of the install-wkhtmltopdf.sh
file (Ensure existing containers with the previous script version are removed before trying):
#!/bin/bash
# wkhtmltopdf installation process taken from:
# https://github.com/LoicMahieu/alpine-wkhtmltopdf/blob/master/Dockerfile
# install wkhtmltopdf if it is not installed
if [ ! -f /usr/bin/wkhtmltopdf ]; then
apk add \
--no-cache \
-X http://dl-cdn.alpinelinux.org/alpine/edge/community \
wkhtmltopdf \
xvfb \
ttf-freefont \
fontconfig \
dbus
apk add \
--no-cache \
-X http://dl-cdn.alpinelinux.org/alpine/edge/testing \
qt5-qtbase-dev
# Wrapper for xvfb
mv /usr/bin/wkhtmltopdf /usr/bin/wkhtmltopdf-origin && \
echo $'#!/usr/bin/env sh\n\
Xvfb :0 -screen 0 1024x768x24 -ac +extension GLX +render -noreset & \n\
DISPLAY=:0.0 wkhtmltopdf-origin $@ \n\
killall Xvfb\
' > /usr/bin/wkhtmltopdf && \
chmod +x /usr/bin/wkhtmltopdf
fi
That seems to work for me. Not sure about long term reliability but it did export. Installing and running WKHTML can be a pain hence why the BookStack default is the less accurate (But still great project) DomPDF.
Other PDF export options have been requested before in BookStack, Some will be view based, some will be renderer based. It's a bit tricky since I don't just want to expose all existing options as BookStack .env
options since I don't like implementation-specific options since it'll make things more fragile. I'll have a think, maybe simply an option for developers to override /config values, knowing such changes are risky and unsupported. If you want to talk further about options, feel free to find an existing issue or open a new one on the BookStack repo, since I don't want to distract the ls.io team on here if the discussion is not directly about their awesome containers.
from docker-bookstack.
I've been playing around with this tonight as well. Unfortunately I don't know enough about this kind of thing.
I can offer some modifications to the script above to gain access to snappy.php
if that is helpful. But it wouldn't be updated if it were to be modified upstream.
from docker-bookstack.
@ssddanbrown your script works for me as well, thank you!
I will continue the discussion about the configuration on the Bookstack repo.
@CHBMB with the current script I think we can close the issue for the moment until a proper solution gets integrated in the upstream project. If I really need to I can hack together a working solution for my self and for other users it's most likely better if they have a proper solution which is supported :).
Shall I create a pull request to extend the README to show how to get wkhtmltopdf working or do we leave it here in the issues?
from docker-bookstack.
Related Issues (20)
- [BUG] An Error Occurred An unknown error occurred HOT 15
- [BUG] Error at container setup while chown-ing laravel.log HOT 10
- [BUG] <DB User Acces denied>
- Nginx can not support IPV6? HOT 6
- SQLSTATE Error during migration HOT 4
- [FEAT] Add Version Tags to docker images HOT 6
- Cannot login with the default user and password - Issue also to create a new admin user inside of the Docker HOT 4
- SQLSTATE during migration HOT 3
- [BUG] Error uploading big images HOT 6
- [BUG] SQL error attempting to create table "migration" HOT 2
- [BUG] uploaded images can not be found after move to container HOT 4
- [BUG] NGINX inside the image is badly configured. HOT 6
- 500 Internal Server Error HOT 14
- QNAP QTS Container Station deployment HOT 4
- [BUG] EXIF functionality of bookstack not working, due to missing package HOT 2
- [BUG] HTTP ERROR 500 occurred while uploading a cover to a shelf or book HOT 2
- [BUG] Issue setting up proxy_set_header for IP Address in nginx log HOT 5
- [FEAT] SSL certificate change HOT 2
- [BUG] Stupid latest tag for images HOT 11
- [FEAT] Merge page HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-bookstack.