<p>We've used it successfully to generate PDF tickets for orders. It may/may not help in your case.</p>

<p>On our order page, we simply have:</p>

<pre><code>&lt;a target="_blank" href="/orders/tickets?orderId={{ order.number }}"&gt;Download PDF Tickets&lt;/a&gt;
</code></pre>

<p>Then, our <code>order/tickets</code> template:</p>

<pre><code>{% set html %}
    {% set orderId = craft.request.param('orderId') %}

    // HTML/CSS to generate ticket
    &lt;html&gt;
    &lt;head&gt;
    &lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt;
    &lt;style&gt;

    body {
        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
        font-size: 13px;
        line-height: 1.4em;
        font-weight: bold;
    }

    &lt;/style&gt;
    &lt;/head&gt;

    &lt;body&gt;

        // Ticket HTML

    &lt;/body&gt;

    &lt;/html&gt;

{% endset %}

{% set settings = {
    compress: true,
    orientation: 'portrait',
    size: 'letter',
    cacheDirectory: 'cache/tickets',
    filename: 'TICKET-' ~ craft.request.param('orderId') ~ '.pdf'
} %}

{% set pdf = craft.printmaker.pdfFromHtml(html, settings) %}

{{ pdf.output }}
</code></pre>

CC BY-SA 3.0
2015-10-23T14:14:52.727Z
Thanks for your help!  I now seem to be getting somewhere....  I've used this href="/barristerPDF?entryId={{ entry.id }}" to link to the PDF template.  Unfortunately the PDF is blank due to non of the field data being pulled through?  My URL has /barristerPDF?entryId=201 which is the correct entry ID?

I've stripped back to just {{ entry.title }} as a test but nothing :(
Martin
CC BY-SA 3.0
2015-10-23T15:49:54.600Z
@Martin do you have an craft.entries criteria model in your template to get the entry with that ID?
carlcs
CC BY-SA 3.0
2015-10-23T15:56:51.193Z
@carlcs - Yes I added an Criteria Model but i'm really just flying blind now :/  {% set entryId = craft.request.param('entryId') %}   {% set entries = craft.entries.section('barristers') %}
Martin
CC BY-SA 3.0
2015-10-23T15:57:59.240Z
@Martin Try this: `{% set entry = craft.entries.id(entryId).first() %}`
carlcs
CC BY-SA 3.0
2015-10-23T17:33:32.780Z
Yay!!  It's working :D  Thanks @carlcs...  Only issue now is the image isn't being pulled... I get the error "DOMPDF_ENABLE_REMOTE is set to FALSE http://macbook.local:5757/img/barristers/image.jpeg
Martin
CC BY-SA 3.0
2015-10-23T17:43:06.447Z
Sorry, I found DOMPDF_ENABLE_REMOTE is set to FALSE in the DomPDF config files and set it to true.
Martin
CC BY-SA 3.0
2015-12-17T12:18:48.300Z
@Martin where did you find `DOMPDF_ENABLE_REMOTE` I am having the same issue? Thanks.
Gareth
CC BY-SA 3.0
2015-12-17T14:08:05.407Z
Found it, its located at: craft/plugins/printmaker/vendor/dompdf/dompdf_config.inc.php for anyone else.
Gareth
CC BY-SA 3.0
2015-12-17T15:49:45.807Z
Ahh... good @Gareth, was just about to reply :)
Martin
CC BY-SA 3.0
2015-10-23T12:23:49.277Z
2015-10-23T12:23:49.277Z
crawf
<p>Martin,</p>

<p>For reference, here's the template code you shared with me earlier:</p>

<pre><code>{% set html %}

{% set entryId = craft.request.param('entryId') %}

    &lt;html&gt;
    ...    
    &lt;body&gt;
    {{ entry.title }} 
    &lt;/body&gt;
    &lt;/html&gt;

{% endset %}

{% set settings = {
    ...
} %}

{% set pdf = craft.printmaker.pdfFromHtml(html, settings) %}

{{ pdf.output }}
</code></pre>

<p>You're using an <code>entry</code> variable to reference your entry content, but you haven't created such a variable in your template yet.</p>

<p>Also, while <code>{% set entryId = craft.request.param('entryId') %}</code> is valid as a statement by itself, I think it might be conflicting with the opening of your <code>{% set html %}</code> tag pair.</p>

<p>Try this instead:</p>

<pre><code>{% set entryId = craft.request.getParam('entryId') %}

{% set entry = craft.entries.id(entryId).first %}

{% set html %}
    ...
{% endset %}

...
</code></pre>

<p>Check out the <a href="http://michaelrog.com/craft/printmaker" rel="nofollow">Printmaker docs</a> for more code examples.</p>

<p>Cheers!</p>

CC BY-SA 3.0
2015-10-23T21:26:43.500Z
Ooops, looks like a connection glitch on my end delayed this post 'til just now. Glad to see yall already got it sorted.  :)
Michael Rog
CC BY-SA 3.0
2015-10-23T21:22:13.510Z
2015-10-23T21:22:13.510Z
Michael Rog
<p>Has anyone had any success with Printmaker PDF plugin?</p>

<p>I’m not sure where to put the tags?  The only way I can get the template to actually load is to add the Printmaker tags at the end of the document.  In which case, the "Download CV" link further up the page doesn’t work.  It seems {{ pdf.url }} HAS to appear AFTER the Printmaker tags.  If I move the Printmaker tags further up I get the error "Internal Server Error - Requested HTML document contains no data.”.</p>

<p>Also, i’ve linked to a print stylesheet and when I do get a document to be created the print.css is ignored?</p>

<p>Thanks</p>

CC BY-SA 3.0
2016-01-12T16:08:54.837Z
Quite disappointed with the plugin myself, the docs are skeleton at best.
erwinheiser
<pdf><plugin-printmaker>
Help with Printmaker Plugin
# Help with Printmaker Plugin

(Asked by: username_0 on 2015-10-23)

Has anyone had any success with Printmaker PDF plugin?

I’m not sure where to put the tags? The only way I can get the template to actually load is to add the Printmaker tags at the end of the document. In which case, the "Download CV" link further up the page doesn’t work. It seems {{ pdf.url }} HAS to appear AFTER the Printmaker tags. If I move the Printmaker tags further up I get the error "Internal Server Error - Requested HTML document contains no data.”.

Also, i’ve linked to a print stylesheet and when I do get a document to be created the print.css is ignored?

Thanks

**Tags:** pdf, plugin-printmaker
> **Comments:**
> **username_1**: Quite disappointed with the plugin myself, the docs are skeleton at best.  

---

## 2 answers

### Answer by username_2 on 2015-10-23. Score: 3

We've used it successfully to generate PDF tickets for orders. It may/may not help in your case.
On our order page, we simply have:
Download PDF Tickets

Then, our order/tickets template:
{% set html %}
    {% set orderId = craft.request.param('orderId') %}

    // HTML/CSS to generate ticket
    
    
    
    
    

    

        // Ticket HTML

    

    

{% endset %}

{% set settings = {
    compress: true,
    orientation: 'portrait',
    size: 'letter',
    cacheDirectory: 'cache/tickets',
    filename: 'TICKET-' ~ craft.request.param('orderId') ~ '.pdf'
} %}

{% set pdf = craft.printmaker.pdfFromHtml(html, settings) %}

{{ pdf.output }}

> **Comments:**
> **username_0**: Thanks for your help!  I now seem to be getting somewhere....  I've used this href="/barristerPDF?entryId={{ entry.id }}" to link to the PDF template.  Unfortunately the PDF is blank due to non of the field data being pulled through?  My URL has /barristerPDF?entryId=201 which is the correct entry ID?  I've stripped back to just {{ entry.title }} as a test but nothing :(  
> **username_3**: @Martin do you have an craft.entries criteria model in your template to get the entry with that ID?  
> **username_0**: @carlcs - Yes I added an Criteria Model but i'm really just flying blind now :/  {% set entryId = craft.request.param('entryId') %}   {% set entries = craft.entries.section('barristers') %}  
> **username_3**: @Martin Try this: `{% set entry = craft.entries.id(entryId).first() %}`  
> **username_0**: Yay!!  It's working :D  Thanks @carlcs...  Only issue now is the image isn't being pulled... I get the error "DOMPDF_ENABLE_REMOTE is set to FALSE http://macbook.local:5757/img/barristers/image.jpeg  
> **username_0**: Sorry, I found DOMPDF_ENABLE_REMOTE is set to FALSE in the DomPDF config files and set it to true.  
> **username_4**: @Martin where did you find `DOMPDF_ENABLE_REMOTE` I am having the same issue? Thanks.  
> **username_4**: Found it, its located at: craft/plugins/printmaker/vendor/dompdf/dompdf_config.inc.php for anyone else.  
> **username_0**: Ahh... good @Gareth, was just about to reply :)  

---

### Answer by username_5 on 2015-10-23. Score: 1

Martin,
For reference, here's the template code you shared with me earlier:
{% set html %}

{% set entryId = craft.request.param('entryId') %}

    
    ...    
    
    {{ entry.title }} 
    
    

{% endset %}

{% set settings = {
    ...
} %}

{% set pdf = craft.printmaker.pdfFromHtml(html, settings) %}

{{ pdf.output }}

You're using an entry variable to reference your entry content, but you haven't created such a variable in your template yet.
Also, while {% set entryId = craft.request.param('entryId') %} is valid as a statement by itself, I think it might be conflicting with the opening of your {% set html %} tag pair.
Try this instead:
{% set entryId = craft.request.getParam('entryId') %}

{% set entry = craft.entries.id(entryId).first %}

{% set html %}
    ...
{% endset %}

...

Check out the Printmaker docs for more code examples.
Cheers!

> **Comments:**
> **username_5**: Ooops, looks like a connection glitch on my end delayed this post 'til just now. Glad to see yall already got it sorted.  :)  

---

