<ol>
<li><p>Unfortunately, <em>Printmaker</em> must regenerate the PDF on every save... It can’t simply check to see whether a certain PDF file already exists, because the underlying content or template may have changed that PDF was last generated. You can use Craft's template caching to capture PDF URLs/filenames, to avoid unnecessarily generating the PDF if <em>you</em> know the underlying content hasn't changed.</p></li>
<li><p>You can use Google Fonts (or any other external web font) by linking an external stylesheet, or by including the <code>@font-face</code> directive in your inline styles.</p></li>
<li><p><em>Printmaker</em> saves PDF to files in a cache directory that you specify, but it doesn't create or update an Asset element. You could write a custom plugin to do that, leveraging Printmaker's API. Alternatively, you can commission <em>Top Shelf Craft</em> to develop the functionality you need.</p></li>
</ol>

<p>Feel free to write <code>support@topshelfcraft.com</code> or post additional questions here on SE if I can be of further help!</p>

CC BY-SA 3.0
2017-01-31T19:38:21.627Z
Hm OK, So, it's a bit useless for me. You're right, the Content can changed but a simple option to generate this file one time would be, hm nice? :)

And what you mean with caching? `{% cache %} Tag? I don't know how if I can cache this with this Tag. Hm. Overall… the plugin does what I need but I'm not happy 100% and I can't launch now (PHP7 Bug in Dom PDF, wrote you an email about that).
davidhellmann
CC BY-SA 3.0
2017-01-31T20:33:38.243Z
Actually, that's not a bad idea: I could add an *overwrite* param to tell Printmaker not to bother regenerating a file if it already exists. Also, as you've discovered, you can use a Preparse field to store the URL to a PDF. Meanwhile, trying to resolve that PHP 7.1 issue for you.  :-)
Michael Rog
CC BY-SA 3.0
2017-02-07T08:11:05.360Z
Yeah I use preparse and it works fine. To store it in a field after generating would  be yet better. But I know, it's not the use case most of the time. But thanks anyway :)
davidhellmann
CC BY-SA 3.0
2017-01-16T02:32:19.140Z
2017-01-16T02:32:19.140Z
Michael Rog
<ol>
<li>Why he generate the PDF again and again when nothing changes? Is there a hidden option for that?</li>
<li>I tried to use it with the Google Font <code>Rubik</code> but no chance. Any Ideas?</li>
<li>Is it possible to Save the generated PDF in an Asset field to the Post?</li>
</ol>

<p>I've a preparse Field at the Moment but I've nothing what I can prompt if it's exist or not. He also regenerate the PDF on every Save. No cool :/</p>

<p>Here is my Preparse Field</p>

<pre><code>{% spaceless %}
  {% if not entry.preparsePrintmakerCertificate|length %}
    {% set html %}
      &lt;html&gt;
      &lt;head&gt;
        &lt;meta http-equiv="content-type" content="text/html; charset=utf-8"/&gt;
        &lt;style&gt;
          @page {
            margin: 0in;
          }

          @font-face {
            font-family: 'Rubik Webfont';
            src: url('/assets/fonts/Rubik-Black.ttf') format('truetype');
            font-weight: 900;
            font-style: normal;
          }

          body {
            font-family: "Rubik Webfont", sans-serif;
            font-weight: 900;
            margin: 0;
            padding: 0;
            font-size: 160px;
            line-height: 1;
            width: 100%;
            height: 100%;
            position: relative;
            color: #2e3743;
            text-transform: uppercase;
            letter-spacing: -6px;
            background-image: url('/assets/images/bitmap/printmaker/certificate_background.png');
          }

          .background {
            position: fixed;
            width: 100%;
            height: 100%;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
          }

          .name {
            position: fixed;
            width: 1000px;
            left: 356px;
            top: 2764px;
          }

          .date {
            position: fixed;
            width: 900px;
            left: 356px;
            top: 4318px;
          }
        &lt;/style&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;div class="background"&gt;
        &lt;div class="name"&gt;
          {{ entry.title }}
        &lt;/div&gt;
        &lt;div class="date"&gt;
          &lt;span class="month"&gt;{{ entry.postDate.format('M') }}&lt;/span&gt;
          &lt;span class="day"&gt;{{ entry.postDate.format('d') }}&lt;/span&gt;&lt;br/&gt;
          &lt;span class="year"&gt;{{ entry.postDate.format('Y') }}&lt;/span&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;/body&gt;
      &lt;/html&gt;
    {% endset %}

    {% set settings = {
        filename : 'bestwebsite-gallery_sotd_' ~ entry.postDate.format('Y-m-d') ~ '_' ~ entry.slug|kebab
    } %}
    {% set pdfUrl = craft.printmaker.pdfFromHtml(html, settings).url %}
    {{ pdfUrl }}
  {% endif %}
{% endspaceless %}
</code></pre>

CC BY-SA 3.0
2017-01-16T02:34:00.093Z
Howdy David — Thanks for these questions! In the future, please try to ask only one question per SE post. (Questions are easier to search that way, which makes the answers more accessible to others in the future.)
Michael Rog
<pdf><plugin-printmaker><dompdf>
Printmaker Plugin — Some Questions
# Printmaker Plugin — Some Questions

(Asked by: username_0 on 2017-01-15)

Why he generate the PDF again and again when nothing changes? Is there a hidden option for that?
I tried to use it with the Google Font Rubik but no chance. Any Ideas?
Is it possible to Save the generated PDF in an Asset field to the Post?

I've a preparse Field at the Moment but I've nothing what I can prompt if it's exist or not. He also regenerate the PDF on every Save. No cool :/
Here is my Preparse Field
{% spaceless %}
  {% if not entry.preparsePrintmakerCertificate|length %}
    {% set html %}
      
      
        
        
      
      
      
        
          {{ entry.title }}
        
        
          {{ entry.postDate.format('M') }}
          {{ entry.postDate.format('d') }}
          {{ entry.postDate.format('Y') }}
        
      
      
      
    {% endset %}

    {% set settings = {
        filename : 'bestwebsite-gallery_sotd_' ~ entry.postDate.format('Y-m-d') ~ '_' ~ entry.slug|kebab
    } %}
    {% set pdfUrl = craft.printmaker.pdfFromHtml(html, settings).url %}
    {{ pdfUrl }}
  {% endif %}
{% endspaceless %}

**Tags:** pdf, plugin-printmaker, dompdf
> **Comments:**
> **username_1**: Howdy David — Thanks for these questions! In the future, please try to ask only one question per SE post. (Questions are easier to search that way, which makes the answers more accessible to others in the future.)  

---

## 1 answers

### Answer by username_1 on 2017-01-16. Score: 3

1. Unfortunately, *Printmaker* must regenerate the PDF on every save... It can’t simply check to see whether a certain PDF file already exists, because the underlying content or template may have changed that PDF was last generated. You can use Craft's template caching to capture PDF URLs/filenames, to avoid unnecessarily generating the PDF if *you* know the underlying content hasn't changed.
2. You can use Google Fonts (or any other external web font) by linking an external stylesheet, or by including the `@font-face` directive in your inline styles.
3. *Printmaker* saves PDF to files in a cache directory that you specify, but it doesn't create or update an Asset element. You could write a custom plugin to do that, leveraging Printmaker's API. Alternatively, you can commission *Top Shelf Craft* to develop the functionality you need.

Feel free to write `support@topshelfcraft.com` or post additional questions here on SE if I can be of further help!

> **Comments:**
> **username_0**: Hm OK, So, it's a bit useless for me. You're right, the Content can changed but a simple option to generate this file one time would be, hm nice? :)  And what you mean with caching? `{% cache %} Tag? I don't know how if I can cache this with this Tag. Hm. Overall… the plugin does what I need but I'm not happy 100% and I can't launch now (PHP7 Bug in Dom PDF, wrote you an email about that).  
> **username_1**: Actually, that's not a bad idea: I could add an *overwrite* param to tell Printmaker not to bother regenerating a file if it already exists. Also, as you've discovered, you can use a Preparse field to store the URL to a PDF. Meanwhile, trying to resolve that PHP 7.1 issue for you.  :-)  
> **username_0**: Yeah I use preparse and it works fine. To store it in a field after generating would  be yet better. But I know, it's not the use case most of the time. But thanks anyway :)  

---

