Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Define the directory with the font via fontDir configuration key.
*/
add_filter( 'dkpdf_mpdf_font_dir', function ( $font_dir ) {
// path to wp-content directory
$wp_content_dir = trailingslashit( WP_CONTENT_DIR );
array_push( $font_dir, $wp_content_dir . 'fonts' );
return $font_dir;
});
/**
* Define the font details in fontdata configuration variable
*/
add_filter( 'dkpdf_mpdf_font_data', function( $font_data ) {
$font_data['montserrat'] = [
'R' => 'Montserrat-Regular.ttf',
];
return $font_data;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.