-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Images not working when using from ubuntu docker #85
Comments
Hi, the wkhtmltopdf on linux needs some packages to work fine, if you installed the package (wkhtmltopdf.deb) in you pc and just copied the file wkhtmltopdf to the application folder, this can cause some problems. The correct is you extract and install the package in the docker image and install all dependencies. Here it work fine to me. but I use one abstraction of docker, my application runs in azure linux web app. try these steps:
docker exec -u 0 -it mycontainer bash
apt-get update
apt-get -y install sudo
dpkg -i wkhtmltox.deb
apt-get -f install
dpkg -i wkhtmltox.deb
sudo cp /usr/local/bin/wkhtmltopdf ~/site/wwwroot/wwwroot/Rotativa |
Install the packages with a script similar to this: #!/bin/sh
apt update
apt -y install wget
### Debian 10 ### (change to your operating system)
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_amd64.deb
apt install -f -y ./wkhtmltox_0.12.6-1.buster_amd64.deb
### Copy files ###
cp -f /usr/local/bin/wkhtmltopdf ~/site/wwwroot/wwwroot/Rotativa
cp -f /usr/local/bin/wkhtmltoimage ~/site/wwwroot/wwwroot/Rotativa |
This is probably because Rotativa injects the base URL property in your HTML. See #60 (comment) . The base URL is set to the internal port your website is listening to, but that port is only accessible by docker. Another port is used for incoming requests. Setting the base URL by Rotativa shouldn't be necessary, as in my opinion you should set the base URL yourself in the HTML if your site needs it. In PR #92 an option is added to disable setting the base URL ( |
Hello,
Not sure if someone struggled with this. I'm testing the library from Windows and have no problems rendering pdfs with links to external public images, but when deploying to an ubuntu docker, images are not shown in the pdf generated. Checked all the permissions to the libraries and I have no problem.
I made sure the docker has internet access and gave permissions to both wkhtmltopdf and wkhtmltoimage
(followed this link: #17)
does anyone have any idea?
Thanks!
The text was updated successfully, but these errors were encountered: