Printmaker plugin cuts off HTML when rendering PDF link I’ve got a funny Printmaker issue here that I hope you can help me with!

I’m using the following code to generate a link to a PDF:

{% set vars = { title: supportGuides.title, body: supportGuides.body } %}

{% set settings = { orientation : 'portrait', filename:supportGuides.slug~'.pdf' } %}

{% set pdf = craft.printmaker.pdfFromTemplate('support-guides/download', vars, settings) %}

&lt;a href=“{{ pdf.url }}" target="_blank"&gt;Download PDF Support Guide&lt;/a&gt;


In my HTML output, the beginning of the line is stripped out inexplicably:

https://mysite.dev/Printmaker/support-guide.pdf" target="_blank"&gt;Download PDF Support Guide&lt;/a&gt;


How can I prevent the opening tag from being cut out like that?
Depending on your server setup, DOMPDF might be resetting the output buffer when the PDF is generated. This is a fairly rare issue, but I have heard of it before.

Solution: Try moving the Printmaker PDF-generation code to the top of the template before any output.

For example, at the top of the template...

{% set pdfUrl = craft.printmaker.pdfFromTemplate('support-guides/download', vars, settings).url %}


...and then later, in your output content...

&lt;a href="{{ pdfUrl }}" target="_blank"&gt;Download PDF Support Guide&lt;/a&gt;