11

I have managed to clean up the display of membership lists (civireport) to the satisfaction of our users by linking a CSS file to the report header, but I do not find how to adjust the font and layout of generated PDF (is that even possible?)

1

The PDF generator uses the HTML to create the PDF. So changing CSS will have effect. But.. to have a different font in the PDF, the font should be available on the server. If the font is not available on the server (and the pdf generator) then a fall-back font is used.

Here's some more info about DOMPDF (the tool CiviCRM is using for creating PDF's):

  1. https://stackoverflow.com/questions/12581156/custom-fonts-for-dompdf
  2. https://github.com/dompdf/dompdf/wiki/About-Fonts-and-Character-Encoding
1

Did you look at print.css? It is in the civicrm/css folder.

0

You need to use inline css. I think it has something to do with Civi using mail framework to generate its templates.

  • I had already discovered that, thanks (see question!). No, sorry, I am asking about the layout of PDF reports – David Christie Sep 2 '15 at 4:58
  • 1
    Oh, sorry! You probably know this too then: in each report instance you have the possibility to edit the header and footer of the PDF display of reports, by changing the html code found under Report settings. At the bottom of the header code, you have a line starting like this: <body><div id="crm-container"> I suspect that if you enter inline css to that div, it will affect the style and fonts of the entire report. – Flying Sep 2 '15 at 6:26
  • There you actually also have the possibility to link to a different css-file for the whole report, as explained in the tip for the header – Flying Sep 2 '15 at 7:00
  • My CSS inline stuff only affected the screen layout but not the generated PDF, which is probably reasonable, since CSS has little to do with PDF. It looked to me that the PDF was generated by a different mechanism – David Christie Sep 2 '15 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.