wkhtmltopdf – ubuntu dependency problems while installing

So, I am using wkhtmltopdf or knp/snappy-bundle for generating pdf files in my Symfony project.

I am using docker-compose build command to install it by adding installation to my dockerfile.

It throws an error as:

dependency problems prevent configuration of wkhtmltox:
wkhtmltox depends on fontconfig; however:
Package fontconfig is not installed.
wkhtmltox depends on libpng12-0; however:
Package libpng12-0 is not installed.
wkhtmltox depends on libssl1.0.0; however:
Package libssl1.0.0 is not installed.
wkhtmltox depends on libx11-6; however:
Package libx11-6 is not installed.
wkhtmltox depends on libxcb1; however:
Package libxcb1 is not installed.
wkhtmltox depends on libxext6; however:
Package libxext6 is not installed.
wkhtmltox depends on libxrender1; however:
Package libxrender1 is not installed.
wkhtmltox depends on xfonts-75dpi; however:
Package xfonts-75dpi is not installed.
wkhtmltox depends on xfonts-base; however:
Package xfonts-base is not installed.

I don’t think I need to add all of this packages so I can run it. I am on Ubuntu 18.4. I checked the documentation and I added the version that is the best fit for my operating system.

My docker file:

FROM php:7.2-fpm

COPY ./www.conf /etc/php5/fpm/pool.d/www.conf

COPY config/php.ini /usr/local/etc/php/

COPY ./scripts/* /usr/bin/

RUN apt-get update && 
    apt-get install -y --no-install-recommends git zip && 
    curl --silent --show-error https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && 
    apt-get install -y libmcrypt-dev zlib1g-dev libzip-dev libjpeg62-turbo-dev libfreetype6-dev libxml2-dev && 
    pecl install zip && 
    docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ || true && 
    docker-php-ext-install zip || true && 
    docker-php-ext-install xml || true && 
    docker-php-ext-install pdo pdo_mysql || true && 
    apt-get install -y libpng-dev wget || true


RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.jessie_amd64.deb && dpkg -i wkhtmltox_0.12.5-1.jessie_amd64.deb

RUN docker-php-ext-install gd || true

WORKDIR /var/www/html

CMD /usr/bin/wait-for-it.sh -t 60 onepay_mysql:3306 && sh /usr/bin/web-init.sh && php-fpm

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *