tFPDF icon indicating copy to clipboard operation
tFPDF copied to clipboard

Path to fonts is hard coded

Open Norore opened this issue 4 years ago • 2 comments

First of all: thank you very much for this patch, it save me a lot of hours!

I just had a problem with the path to fonts used to generate the PDF in production, in a Symfony 3.4+ project. Path seems to be hard coded in *.php and *.dat files in font/unifont folder, as see in this answer from StacOverflow: https://stackoverflow.com/a/38520012/1866679 After removing the incriminated files, my PDF is generated as wanted under production server. Is there a way to avoid this trouble or did I have to avoid those files to be uploaded under production?

Norore avatar Jun 02 '20 16:06 Norore

I'm with you. IMHO these files have nothing todo in this folder at all. Also individual font files should not be located in the vendor folder... but

This repository is only made for cloning official tFPDF releases which are available at: http://fpdf.org/en/script/script92.php THERE WILL BE NO DEVELOPMENT IN THIS REPOSITORY!"

So you should write a patch and send it to the FPDF forum so that Olivier has a chance to update the package accordingly. Keep backwards compatibility in mind.

JanSlabon avatar Jun 02 '20 17:06 JanSlabon

@Norore you can define your default font path by define('FPDF_FONTPATH', $pathToYourFonts); which you can keep outside the vendor folder and track with your VCS. But you should make sure to not track *.php and *.dat files. Just add a .gitignore in this directory with

*.php
*.dat

iwasherefirst2 avatar Dec 09 '21 14:12 iwasherefirst2