Answers.Body: <p>You can link to the CSS in this way, but if it's not working for you then try changing the path to</p>
  
  <pre><code>&lt;link href="./pdf.css" rel="stylesheet" type="text/css"&gt;
  </code></pre>
  
  <p>assuming that your CSS is in the site root.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-30T19:59:13.477Z
Answers.Text: Yes. That does it.
Answers.UserDisplayName: seth
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-30T20:01:38.823Z
Answers.Text: An include in the head works as well:
  
  `<head><style type="text/css">{% include '_includes/_pdf/pdf.css' %}</style></head>`
Answers.UserDisplayName: seth
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-30T16:53:53.187Z
Answers.LastActivityDate: 2018-09-30T16:53:53.187Z
Answers.UserDisplayName: foamcow
Body: <p>Similar to this issue <a href="https://craftcms.stackexchange.com/questions/16567/render-styled-output-using-printmaker-plugin">Render styled output using Printmaker plugin</a></p>
  
  <p>I am having the same issue and can't seem to figure out how to style the PDF.</p>
  
  <p>Here is my code to generate the PDF:</p>
  
  <pre><code>    {% set html %}
          {% include '_includes/_pdf/social.twig' %}
      {% endset %}
  
      {% set pdfUrl = craft.printmaker.pdfFromHtml(html).url %}
  
      &lt;a href="{{ pdfUrl }}" target="_blank"&gt;Print Page&lt;/a&gt;
  </code></pre>
  
  <p>This opens the PDF in a separate tab.</p>
  
  <p>and then I am loading <code>pdf.css</code> into the head of <code>_includes/_pdf/social.twig</code> but the PDF is not styled.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en" dir="ltr"&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;title&gt;PDF Template&lt;/title&gt;
          &lt;link href="pdf.css" rel="stylesheet" type="text/css"&gt;
      &lt;/head&gt;
      &lt;body&gt;
  
          // PDF HTML
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and here is my directory structure</p>
  
  <pre><code>_includes
      _pdf
          pdf.css
          social.twig
  </code></pre>
  
  <p>Is it possible to style the PDF this way or do I need to use <code>&lt;style&gt;</code> tag or inline styles?</p>
  
Tags: <craft2><plugin-printmaker>
Title: Trying to style Printmaker Plugin PDF by linking css in head of PDF template
ThreadText: # Trying to style Printmaker Plugin PDF by linking css in head of PDF template
  
  (Asked by: username_0 on 2018-09-30)
  
  Similar to this issue [Render styled output using Printmaker plugin](https://craftcms.stackexchange.com/questions/16567/render-styled-output-using-printmaker-plugin)
  
  I am having the same issue and can't seem to figure out how to style the PDF.
  
  Here is my code to generate the PDF:
  
  ```
      {% set html %}
          {% include '_includes/_pdf/social.twig' %}
      {% endset %}
  
      {% set pdfUrl = craft.printmaker.pdfFromHtml(html).url %}
  
      <a href="{{ pdfUrl }}" target="_blank">Print Page</a>
  
  ```
  
  This opens the PDF in a separate tab.
  
  and then I am loading `pdf.css` into the head of `_includes/_pdf/social.twig` but the PDF is not styled.
  
  ```
  <!DOCTYPE html>
  <html lang="en" dir="ltr">
      <head>
          <meta charset="utf-8">
          <title>PDF Template</title>
          <link href="pdf.css" rel="stylesheet" type="text/css">
      </head>
      <body>
  
          // PDF HTML
  
      </body>
  </html>
  
  ```
  
  and here is my directory structure
  
  ```
  _includes
      _pdf
          pdf.css
          social.twig
  
  ```
  
  Is it possible to style the PDF this way or do I need to use `<style>` tag or inline styles?
  
  **Tags:** craft2, plugin-printmaker
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-09-30. Score: 1 | Accepted answer
  
  You can link to the CSS in this way, but if it's not working for you then try changing the path to
  
  ```
  <link href="./pdf.css" rel="stylesheet" type="text/css">
  
  ```
  
  assuming that your CSS is in the site root.
  
  > **Comments:**
  > **username_0**: Yes. That does it.  
  > **username_0**: An include in the head works as well:  `<head><style type="text/css">{% include '_includes/_pdf/pdf.css' %}</style></head>`  
  
  ---
  
  