Viewing 5 replies - 1 through 5 (of 5 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

    Thread Starter Corbett Enders

    (@cenders)

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

    Thread Starter Corbett Enders

    (@cenders)

    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.

    Thread Starter Corbett Enders

    (@cenders)

    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

    Hey there Corbett – @cenders, do you happen to know how I can change the line-height between the paragraph rows?
    I want to reduce that spacing but adding line-height inline in the editor isn’t changing anything. I appreciate it if you have any insight on this. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Changing font in PDF’ is closed to new replies.