Support » Plugin: Send PDF for Contact Form 7 » Changing font in PDF

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Florent Maillefaud

    (@florent73)

    Hi!

    Can you testing the last version in GitHub : https://github.com/Florent73/send-pdf-for-contact-form-7

    This version gives you the choice of font and size.

    Thanks

    Awesome, I see a font menu and size. Can I add to the list of fonts somehow?

    The font menu seems to default to DejaVuSans yet the only fonts I see in my PDF are DejaVuSerif.

    So I don’t believe it is working but I’d also love to be able to reference a custom font either in the HTML or CSS. I believe mPDF supports this.

    I’ve figured out (for now) how to manually define fonts to be used by your script. I’m going to document it here for anyone who needs this assistance until such time that your script will allow for some customization. I love your script, I hope you continue to develop it.

    First, ensure the font file you have is a true type font. I wasted a fair bit of time because my .TTF file was actually open type font. I found an online converter.

    Inside send-pdf.php (classes folder), make the following adjustments.

    Look for the following line in / around line 643:

    $mpdf = new \Mpdf\Mpdf([‘mode’ => ‘utf-8’,……

    Add to that list of configuration variables the following (replacing the font file name and the font friendly name with your own requirements):

    ‘fontDir’ => array_merge($fontDirs, [WPCF7PDF_DIR . ‘/fonts’,]),
    ‘fontdata’ => $fontData + [‘futurastdlight’ => [‘R’ => ‘FuturaStdLight.ttf’]],
    ‘default_font’ => ‘futurastdlight’,

    Create a ‘fonts’ folder inside the root of the send-pdf-for-contact-form-7 folder in your webserver and upload your font file to that folder.

    This changes the entire font using in the PDF. I could not figure out how to use CSS styling within the plugin body itself where you create the PDF layout.

    Referenced these instructions: https://mpdf.github.io/fonts-languages/fonts-in-mpdf-7-x.html

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.