Skip to content

Instantly share code, notes, and snippets.

@Mosallamy
Last active September 24, 2023 10:56
Show Gist options
  • Save Mosallamy/f3eb1b972b9aaf601d2e9e0855b0a953 to your computer and use it in GitHub Desktop.
Save Mosallamy/f3eb1b972b9aaf601d2e9e0855b0a953 to your computer and use it in GitHub Desktop.
Wkhtmltopdf - Arabic PDF differs between Mac and Linux
#When I deployed my Flask HTML/CSS to PDF application on Ubuntu server, Wkhtmltopdf rendered the same PDF with different #styles.
#The Ubuntu version rendered:
# 1- long Arabic text in one line without wrapping the text
# 2- the CSS alignment was not accurate
# 3- black header was auto generated
#The solution was to uninstall the current version of Wkhtmltopdf and install Wkhtmltopdf With Patched QT Setup.
#---------------------------- Steps:
#---------------------------- A- Unistall Wkhtmltopdf:
sudo apt-get remove wkhtmltopdf
#---------------------------- B- Install Wkhtmltopdf With Patched QT Setup:
# [I found the solution for installing Wkhtmltopdf in the following gist:
# https://gist.github.com/Rajeshr34/2e9b2438ff142e51c729b4b9b772680a
cd ~
sudo apt-get install libfontenc1 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig -y
sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo apt --fix-broken install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment