Cannot change font in PDF Template, only rendered as Dejavu

Version: 7.8.22

Hi everyone,
My PDF Template generated PDF files in only Dejavu font family even I have changed it to other fonts like Time News Roman or Arial.
I’ve checked raw code in database and its tag font-family is correct in format but the PDF Template keep rendering contents in Dejavu font.

Is there a work around to check and fix this issue? Thanks in advance

1 Like

Any one please?

I’m looking for a solution as well.
Were you able to resolve it?

What version you’re using? Do you have any errors in log files?

I can try helping but I need more detail…

  • version of SuiteCRM
  • where is the PDF template entered into SuiteCRM? Is it in the PDF Templates module?
  • where is it rendered? What do you click, and where, to see the results?

Hello, thanks for replying.
I’m working on CRM Suite version 7.10.36
I haven’t seen any errors in the log
I really want to add another font to use in my PDFs
But I’ve come to this post because the same thing is happening to me.
In modules/AOS_PDF_Templates/generatePdf.php
the value is set by default: dejavusanscondensed

            $pdf = new mPDF(
                'en', 
                $template->page_size . $orientation, 
                '', 
                'dejavusanscondensed', 
                $template->margin_left, 
                $template->margin_right, 
                $template->margin_top, 
                $template->margin_bottom, 
                $template->margin_header, 
                $template->margin_footer
            );

Similarly, if this value is removed, the mPDF library applies this by default, this can be seen in modules/AOS_PDF_Templates/PDF_Lib/mpdf.php

I followed these steps to add the font
(I think I followed these steps from here: How to add fonts to the PDF Template editor)
The font called Studio-Pro-Bold.ttf

  1. I add it to the folder modules/AOS_PDF_Templates/PDF_Lib/ttfonts/
  2. in modules/AOS_PDF_Templates/PDF_Lib/config_fonts.php
    I add the font to the array $this->fontdata
$this->fontdata = array(

    'studio' => array(
        'R' => "studio-pro-bold.ttf",
        'B' => "studio-pro-bold.ttf",
        'I' => "studio-pro-bold.ttf",
        'BI' => "studio-pro-bold.ttf",
    ),
...
  1. in modules/AOS_PDF_Templates/PDF_Lib/classes/ttfontsuni.php
    There are some exceptions that occur on lines 110 and 116, if I send a aos_quote to print, I get the error: “Postscript outlines are not supported”
    So I went there and commented out the lines:
    This caused the font files to be generated in: modules/AOS_PDF_Templates/PDF_Lib/ttfontdata
    Then I uncommented the code
        if ($version==0x4F54544F) {
            die("Postscript outlines are not supported");
        }
        if ($version==0x74746366 && !$TTCfontID) {
            die("ERROR - You must define the TTCfontID for a TrueType Collection in config_fonts.php (". $file.")");
        }
        if (!in_array($version, array(0x00010000,0x74727565)) && !$TTCfontID) {
            die("Not a TrueType font: version=".$version);
        }
  1. in modules/AOS_PDF_Templates/views/view.edit.php
    I add the font to tiny.init, in the theme_advanced_fonts property

But none of this worked either… :rofl:

Maybe it is taking it from this:

$pdfConfig = [
    'mode' => 'en',
    'page_size' => $template->page_size,
    'font' => 'DejaVuSansCondensed',
    'margin_left' => $template->margin_left,
    'margin_right' => $template->margin_right,
    'margin_top' => $template->margin_top,
    'margin_bottom' => $template->margin_bottom,
    'margin_header' => $template->margin_header,
    'margin_footer' => $template->margin_footer,
    'orientation' => $template->orientation
];


In new SuiteCRM versions, we have only TCPDF Engine for the PDF Template (Admin → PDF Settings)

config.php

  'pdf' => 
  array (
    'defaultEngine' => 'TCPDFEngine',
  ),