2

Is it possible to 'view' an order's PDF rather than download/create it first? I ask because I'm working on PDF templates and I can't figure out how to view the progress/changes I'm making without having to re-download a order PDF everytime.

3

No, I don't think there's a way of having a "live" pdf open, in the same way as a webpage.

But, what I usually do is just open the pdf template directly in the browser and create the HTML and CSS while using my normal workflow to check how it looks in the browser. This usually get me 95% of the way, and then I can do the final tweaks when I see what dompdf makes of it.

You need a variable order that's an OrderModel to make this work, so I just grab one like this at the top of my template or in my layout:

{% if not order is defined %}
    {% set order = craft.commerce.orders.first() %}
{% endif %}

And if you want to test with different orders you can get one at random, or a specific one by id.

  • I kinda figured that'd be the case. Your method is good enough - should save some time! Thanks – taylor Nov 21 '16 at 18:41
  • Fortunately, the Brave Browser does that. – Marcus Scheller Nov 3 '17 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.