Why mPDF does not work as expected in server ? (Images are not showing and styles issue)

  centos, laravel, laravel-excel, mpdf, php

Local Environment:

  • PHP: v8.0.2
  • Framework: Laravel v8.*
  • mPDF Version: v8.0.10
  • Deploying With: Laravel Deployer / PHP deployer (deployer)
  • Operating System and Version: macOs Cataline 10.15.5 & Laravel Valet

Production Environment:

  • PHP: v8.0.2
  • Framework: Laravel v8.*
  • mPDF Version: v8.0.10
  • Product version: Plesk Obsidian 18.0.32.
  • OS version: CentOS 7.9.2009 x86_64

Description

It works very well in the local environment but it doesn’t excepted work like local environment in the server.

I want to show you some examples with pictures:

IN THE LOCAL ENVIRONMENT

In local environment

IN THE SERVER

In local server

As you can see, the pictures do not appear in pdf in the server side output, the styles are distorted and ₺ (Turkish Lira) symbol not showing. I don’t understand why this is happening. Do I need to install an extra extension on the server?

NOTES

  • I’m using it with laravel-excel
  • I give file permission 777 to tmpDir (/tmp/phpsppdf/mpdf)

Source: Laravel

Leave a Reply