Dinamiko / dk-pdf

WordPress to PDF made easy
https://wordpress.org/plugins/dk-pdf
26 stars 23 forks source link

custom fonts (make persistent after plugin update) #47

Closed alexanderhofstaetter closed 7 years ago

alexanderhofstaetter commented 7 years ago

i used custom fonts (i followed this documentation: https://mpdf.github.io/fonts-languages/fonts-in-mpdf-6-x.html) and it works great.

but i have to insert the .ttf files in the plugin directory and manually edit "config_fonts.php" which is also in the plugin directory.

i wonder how i can user this persistent (to stay after an plugin update) ?

Dinamiko commented 7 years ago

Yep, that is something tricky to implement, the solution could be some 'bridge' between mPDF and DK PDF, I tried that in the past but never found a solution that worked.

Right now adding custom fonts is customization 'out of the scope' of the plugin functionallity so you have to deal with that yourself on plugin updates.

Being said that, if you have any ideas about how that can be handled, I'm all open to suggestions :)

Thanks, Emili

alexanderhofstaetter commented 7 years ago

see this: https://stackoverflow.com/questions/39120906/mpdf-use-another-font-without-editing-the-package-files

define the path constants before including the mpdf package and point them to files and folders in the plugin dir.

eg wp-content/plugins/dk-pdf/config_fonts.php wp-content/plugins/dk-pdf/ttfonts/

and then include the mpdf's built in fonts. so mpdf libary dont get touched

an additional step could be to assign higher priority to files in the themes dir e.g.: /wp-content/themes/xyz/dkpdf/ and overwrite theme (same principe as woocommerce templates)

Dinamiko commented 7 years ago

Temporary closing this issue due to plugin refactoring plan. Once I have next steps decided I may come back to this issue and reopen it or create a new one based on it.