Answers.Body: <p>Another option to try is to use inline fonts encoded in the base64 format. This prevents file system permission problems. More information can be found in <a href="https://blog.shaharia.com/use-google-web-fonts-for-wkhtmltopdf-tools-to-convert-html-to-pdf/" rel="nofollow noreferrer">this blog entry</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-15T20:50:28.200Z
Answers.LastActivityDate: 2017-01-15T20:50:28.200Z
Answers.UserDisplayName: Kainuk - CiviCooP
Body: <p>I have a problem generating invoices on CiviCRM-4.6.16 with wkhtmltopdf-0.11.0_rc1 on Drupal (7.43).</p>
  
  <p>In the template I define a font-family </p>
  
  <pre><code>@font-face {
  font-family:LiberationSans-Regular;
  src:
  url(/ABSOLUTE/PATH/TO/fonts/LiberationSans-Regular.ttf);}
  </code></pre>
  
  <p>In the Body I define a table I want to use the font like this:</p>
  
  <pre><code>      &lt;table style = "padding-right:19px;font-family:LiberationSans-Regular;" width = "500" height = "100" border = "0" cellpadding = "2" cellspacing = "1"&gt;
  </code></pre>
  
  <p>The font is always ignored, except when I use a system/default font (e.g. Courier).</p>
  
  <p>I tried numerous locations on where to put the fonts, since I suspected a permission problem or something like that, but apparently nothing helps and I can't get other fonts in the pdf export. </p>
  
  <p>I verified that wkhtmltopdf is used (via meta data of the pdf).</p>
  
  <p>Help would be appreciated! </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-01-15T22:55:08.243Z
Comments.Text: If you inspect your webserver logs, do you see `wkhtmltopdf` make requests for font files at the locations you expect while requesting and rendering the invoice HTML? Filesystem permissions shouldn't be an issue since `wkhtmltopdf` would be requesting the files over the network, just like any other browser. So may be worthwhile confirming that this behaviour matches what you see for "normal" desktop browsers.
Comments.UserDisplayName: Chris Burgess
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-01-15T23:01:07.877Z
Comments.Text: [This related SE question/answer](http://stackoverflow.com/a/14864224/43034) suggests that `wkhtmltopdf` 0.11.x has/had issues resolving relative URLs in fonts?
Comments.UserDisplayName: Chris Burgess
Tags: <drupal><pdf><invoice>
Title: Invoice generation wkhtmltopdf font missing
ThreadText: # Invoice generation wkhtmltopdf font missing
  
  (Asked by: username_0 on 2016-11-08)
  
  I have a problem generating invoices on CiviCRM-4.6.16 with wkhtmltopdf-0.11.0\_rc1 on Drupal (7.43).
  
  In the template I define a font-family
  
  ```
  @font-face {
  font-family:LiberationSans-Regular;
  src:
  url(/ABSOLUTE/PATH/TO/fonts/LiberationSans-Regular.ttf);}
  
  ```
  
  In the Body I define a table I want to use the font like this:
  
  ```
        <table style = "padding-right:19px;font-family:LiberationSans-Regular;" width = "500" height = "100" border = "0" cellpadding = "2" cellspacing = "1">
  
  ```
  
  The font is always ignored, except when I use a system/default font (e.g. Courier).
  
  I tried numerous locations on where to put the fonts, since I suspected a permission problem or something like that, but apparently nothing helps and I can't get other fonts in the pdf export.
  
  I verified that wkhtmltopdf is used (via meta data of the pdf).
  
  Help would be appreciated!
  
  **Tags:** drupal, pdf, invoice
  
  > **Comments:**
  > **username_1**: If you inspect your webserver logs, do you see `wkhtmltopdf` make requests for font files at the locations you expect while requesting and rendering the invoice HTML? Filesystem permissions shouldn't be an issue since `wkhtmltopdf` would be requesting the files over the network, just like any other browser. So may be worthwhile confirming that this behaviour matches what you see for "normal" desktop browsers.  
  > **username_1**: [This related SE question/answer](http://stackoverflow.com/a/14864224/43034) suggests that `wkhtmltopdf` 0.11.x has/had issues resolving relative URLs in fonts?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-01-15. Score: 1
  
  Another option to try is to use inline fonts encoded in the base64 format. This prevents file system permission problems. More information can be found in [this blog entry](https://blog.shaharia.com/use-google-web-fonts-for-wkhtmltopdf-tools-to-convert-html-to-pdf/).
  
  
  ---
  
  