Telerik Export to PDF paperSize auto with template?
1 Answer 16 Views
Andrew
Top achievements
Rank 1
Andrew asked on 06 May 2021, 10:00 AM

I'm using .paperSize("auto") for my Export to PDF, and I want using the .TemplateId("templateName") so that I could include a header when I export to PDF. Using paperSize("auto") will not apply the template. How do I use paperSize("auto") and also include a header? Any help with be appreciated

<script type="x/kendo-template" id="page-template">

        <div class="page-template">
            <div class="header">
                #=getDllValueForPrint()#
            </div>
            <div class="footer">
                @*<div style="float: right">Page #: pageNum # of #: totalPages #</div>*@
            </div>
        </div>
    </script>
                                                    .Pdf(pdf => pdf
                                                    .FileName("Customer Orders Summary (Yearly).pdf")
                                                    .AllPages()
                                                    .PaperSize("auto")
                                                    .Margin("2cm", "1cm", "1cm", "1cm")
                                                    .Landscape()
                                                    .TemplateId("page-template")
    function getDllValueForPrint() {
        var CustomerID = $("#CustomerID").data('kendoDropDownList');
        var selectedCustomerName = CustomerID.text();
        return selectedCustomerName;
    }

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 11 May 2021, 05:55 AM

Hello Andrew,

The Template, the RepeatHeaders and the Scale options require PaperSize to be set. They don't work with the default value "auto" of PaperSize: https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/pdf.papersize

Regards,
Ivan Danchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Asked by
Andrew
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or