<?xml version="1.0" encoding="UTF-8"?>
<odoo>

    <template id="print_product_label_pdf_template" name="print_pdf_template">
        <head>
            <title><t t-out="title"/></title>
        </head>
        <body style="margin:auto;">
            <iframe t-att-src="pdf_url" frameborder="0" scrolling="yes" seamless="seamless" style="display:block; width:100%; height:100vh;"></iframe>
        </body>
        <script>
            printPdf = function (url) {
                var iframe = this._printIframe;
                if (!this._printIframe) {
                    iframe = this._printIframe = document.createElement('iframe');
                    document.body.appendChild(iframe);
                    iframe.style.display = 'none';
                    iframe.onload = function() {
                        setTimeout(function() {
                            iframe.focus();
                            iframe.contentWindow.print();
                            }, 1);
                        };
                    }
                    iframe.src = url;
                }
        printPdf("<t t-out="pdf_url"/>")
        </script>
    </template>

</odoo>
