Follow the steps below to add custom fonts to a PDF document.
1) Download and install the latest PDF & Print Pro plugin version to your site.
2) Activate custom PHP code on the "Custom Code" tab on the PDF & Print Pro settings page.
3) Paste the following PHP code. Change "font-name.ttf", "font-name-italic.ttf" and "font-name" to your font filename. Use "R" and "I" for regular and italic fonts. You can add multiple fonts by adding the arrays in the code below.
add_filter( 'pdfprnt_mpdf_config', 'pdfprnt_custom_fonts' );
function pdfprnt_custom_fonts( $config ){
$config['fontdata'] = $config['fontdata'] + array(
'font-name' => array(
'R' => 'font-name.ttf',
'I' => 'font-name-italic.ttf'
),
);
return $config;
}
4) Click on the "Save changes" button.
5) Enable the "Custom СSS" code on the "Output" tab and add the style for the necessary HTML elements. Change "font-name" to your font filename. For Italics, add the font style: italic. Example:
h2 {
font-family: 'font-name';
color: #4c5c68;
font-style: italic;
}
p {
font-family: 'font-name';
color: red;
}
h3 {
font-family: 'font-name';
color: green;
font-style: italic;
}
6) Click on the "Save changes" button.
7) Go to the wp-content/uploads/pdf-print-fonts folder via FTP. If the pdf-print-fonts folder does not exist, you should create it, and set up permissions 755. Put the fonts into this folder - without folders, just files with the fonts in TrueType Font (.ttf) or OpenType Font (.otf) format.
8) Check the output of the PDF document.
Alternatively, you can utilize the "Full Page Capture to PDF" option, which mirrors what is shown on your screen.
This article related to PDF & Print by BestWebSoft plugin
Additional resources: PDF & Print - User Guide
Still need help? Feel free to contact our friendly support team. Create a private ticket