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.
1 Answer
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– taylorCommented Nov 21, 2016 at 18:41
-