Skip to main content
Version: 6.5.0

PDF

Chromium/Chrome

Download

Configuring the PDF generator path

PDF configuration file: config/Components/Pdf.php

Set the local path or a command to the PDF generator in the $chromiumBinaryPath parameter

/**
* Configuration file: Config\Components\Pdf.
*/
class Pdf
{
/**
* The name or path of the chrome/chromium engine.
*
* @see https://www.chromium.org/getting-involved/download-chromium
*
* @var string
*/
public static $chromiumBinaryPath = 'chromium';

/**
* Chromium browser options available for the browser factory.
*
* @see https://github.com/chrome-php/chrome#available-options
*
* @var array
*/
public static $chromiumBrowserOptions = ['noSandbox' => true, 'noProxyServer' => true];
}

Example $chromiumBinaryPath values:

  • chromium
  • chromium-browser
  • google-chrome
  • /usr/bin/google-chrome
  • c:\Program Files (x86)\Google\Chrome\Application\chrome.exe
  • c:\ungoogled-chromium\chrome.exe

Select the new engine

When the $chromiumBinaryPath path is set correctly and the system has access to the location/command you will see a new engine in the PDF panel.

pdf-2.jpg

Simple installation on Linux

A simple script to download the latest version without installation.

Make sure your system has installed all required dependencies. Thanks Puppeteer

The list of required packages may vary depending on the distribution and version. https://source.chromium.org/chromium/chromium/src/+/main:chrome/installer/linux/debian/dist_package_versions.json

Debian (e.g. Ubuntu)
ca-certificates
fonts-liberation
libappindicator3-1
libasound2
libatk-bridge2.0-0
libatk1.0-0
libc6
libcairo2
libcups2
libdbus-1-3
libexpat1
libfontconfig1
libgbm1
libgcc1
libglib2.0-0
libgtk-3-0
libnspr4
libnss3
libpango-1.0-0
libpangocairo-1.0-0
libstdc++6
libx11-6
libx11-xcb1
libxcb1
libxcomposite1
libxcursor1
libxdamage1
libxext6
libxfixes3
libxi6
libxrandr2
libxrender1
libxss1
libxtst6
lsb-release
wget
xdg-utils

Note: You might need to install ‘libgbm-dev’ and ‘libxshmfence-dev’ also. This is reported for Ubuntu 20.04.
CentOS
alsa-lib.x86_64
atk.x86_64
cups-libs.x86_64
gtk3.x86_64
ipa-gothic-fonts
libXcomposite.x86_64
libXcursor.x86_64
libXdamage.x86_64
libXext.x86_64
libXi.x86_64
libXrandr.x86_64
libXScrnSaver.x86_64
libXtst.x86_64
pango.x86_64
xorg-x11-fonts-100dpi
xorg-x11-fonts-75dpi
xorg-x11-fonts-cyrillic
xorg-x11-fonts-misc
xorg-x11-fonts-Type1
xorg-x11-utils

After installing dependencies you need to update nss library using this command

yum update nss -y
Check out discussions
  • #290 - Debian troubleshooting
  • #391 - CentOS troubleshooting
  • #379 - Alpine troubleshooting
apt-get install -y --no-install-recommends libnss3-tools libatk1.0-0 libatk-bridge2.0-0 libdrm-dev libxkbcommon-dev libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm-dev libasound2
#! /bin/bash

cd $(dirname $0)

LASTCHANGE_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2FLAST_CHANGE?alt=media"

REVISION=$(curl -s -S $LASTCHANGE_URL)

echo "latest revision is $REVISION"

if [ -d $REVISION ] ; then
echo "already have latest version"
exit
fi

ZIP_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F$REVISION%2Fchrome-linux.zip?alt=media"

ZIP_FILE="${REVISION}-chrome-linux.zip"

echo "fetching $ZIP_URL"

rm -rf $REVISION
mkdir $REVISION
pushd $REVISION
curl -# $ZIP_URL > $ZIP_FILE
echo "unzipping.."
unzip $ZIP_FILE
popd
rm -f ./latest
find chromium/* -type d -ctime +1 -exec rm -rf {} \;
ln -s $REVISION/chrome-linux/ ./latest