How to add fonts to the PDF Template editor

Hello,

The PDF Template editor only has a very limited set of available fonts.

How do you add extra fonts to the PDF Template editor ?

Thanks.

Which SuiteCRM version?

Which PDF Template functions are thinking of? I just want to make sure I’m thinking of the same thing. I assume it’s when you create templates from the PDF Templates module and use generate letter in a detail view, am I right?

We are running SuiteCRM 8.1.3

From the “More” pull down menu I select “PDF - Templates”.

I have created a new “Quote” template using the “Quote Sample” as the base design.

Since starting this thread I’ve also attempted to modify the design with the WYSIWYG editor and I have to say that not much works expect for changing text.

If you try and change the number or rows and columns of a pre-exisitng table no changes are made.

If you try and add a new table the table is compressed and if you add text to a cell the padding and spacing is wrong.

I have done a lot of professional html coding and produced many custom reports from sql databases using various tools but I have to say the built in SuiteCRM WYSIWYG editor is very basics indeed. As end documents are customer facing I would have expected SuiteCRM to have a more advanced PDF Template editor. Is the developer community working on any improvements to the editor or replacing it completely ?

I have looked at the html code and considered editing it directly however after reading through some other forum threads on the subject this may not be simple. Some say if you make changes to the html it can be stripped off when its saved. Others have resorted to editing the code directly in the database.

I will need to create a lot of custom layouts. How are others customising forms using the PDF-Templates editor ?

Can you use a different html editor and paste the code into the built in editor . Will it save correctly or does it strip off html code ?

Do you have to save custom code directly into the database by passing the WYSIWYG editor completely ?

And my original question. The editor only has a limited set of fonts. How do you add extras fonts ?

Yes, me (PowerReplacer). And a bunch of other add-on developers, have a look in the Store.

Part of my fixes were directed at the editing problems you mention (such as stripping HTML tags and other types of excessively zealous “security” clean-ups).

Regarding the fonts, I don’t know exactly how, but maybe try editing this configuration here

→ SuiteCRM/generatePdf.php at master · salesagility/SuiteCRM · GitHub

and check the online TCPDF documentation to see what is possible.

There’s very similar code here:

→ SuiteCRM/formLetterPdf.php at master · salesagility/SuiteCRM · GitHub

  • formLetterPdf.php is the (old SugarCRM?) “Print as PDF” button

  • generatePdf.php is the SalesAgility AOS version of PDF generation from several modules (Quotes, Invoices, Contracts, …). It’s button “EmailPDF” and sends emails.

1 Like

I rolled my own solution that appears to work for me. It shows the critical points needed to have custom fonts in the PDF - Templates.

2 Likes

Hello @mingsai,

Thank you for sharing your solution for adding custom fonts for use by PDF - Templates. I will give it a try shortly.

A question for the developers.

In SuiteCRM 8.x under Admin \ System \ PDF Settings you have obviously envisaged the use of other PDF Engine’s. Are there any plans to replace the default engine with a more advanced engine that is open source in the near future ?

Or alternatively have you considered automating the installation of Google fonts using @mingsai technique under PDF Settings ? I’m sure that a developer could implement this feature for the benefit of all the community in the next SuiteCRM release quite easily. Using custom front is a core feature of any CRM and makes the created documents look great. The fonts you get by default look poor by modern standards.

Thanks.

I don’t think the developers have any plans to add engines. There’s just too much work in the project, most of it getting left behind, I don’t see how something like this could be achieved.

I do see people from the Community contributing simple improvements in this area. Google fonts are not a particularly easy addition, they involve downloading files, and possibly licensing issues etc. And other people will have different font requirements, such as their corporate fonts selected (and possibly bought) by their designers, etc.

But I’m sure something could be made to facilitate installation for end-users, such as wrapping this up in something installable from Module Loader. It would make a nice free add-on.

My approach for my PowerReplacer add-on was to provide the full power of HTML and CSS, to the extent that that is possible in emails and PDF’s. You lose the WYSYWYG editors but you gain “technical” freedom of expression.

Hello @pgr,

Yes I do agree the developers have plenty of work to do to get 8.x production ready.

Your PowerReplacer add-on looks awesome. However I would need a few add-ons to make SuiteCRM 8.x usable for us and if I total up the annual cost it would be expensive. I could buy a commercial solution for a lower cost sadly.

I will have to make do with the standard features of SuiteCRM 8.x until it proves itself as a viable tool which generates more business. And if it does I will be able to buy more add-ons.

Thanks for your help.

1 Like