This is a migrated thread and some comments may be shown as answers.

Export to PDF - Page Template not Working Correctly

1 Answer 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 1
Randy asked on 05 Apr 2017, 07:15 PM

I have the following code in an MVC page. When I export to PDF, the content in the "page-template" script tag prints at the bottom of the grid on each page instead of the top, as I thought it should because I've specified a class type of "header".

 

<script type="x/kendo-template" id="page-template">
    <div class="page-template">
        <div class="header">
            <div style="float: right">Page #: pageNum # of #: totalPages #</div>
            Multi-page grid with automatic page breaking
        </div>
    </div>
</script>

<div id="main-content" class="JeffreysContainer">
    <h3 class="text-center">Dealer Closeout History</h3>

    @(Html.Kendo().Grid<JeffreysOnline.Entities.vwCloseout>()
            .Name("grid")
            .Columns(columns =>
            {
                columns.Bound(p => p.CloseoutDate).Width(120).Format("{0:MM/dd/yyyy}");
                columns.Bound(p => p.BeginDate).Width(120).Format("{0:MM/dd/yyyy}");
                columns.Bound(p => p.EndDate).Width(120).Format("{0:MM/dd/yyyy}");
                columns.Bound(p => p.BoothNumber).Title("Booth").Width(80);
                columns.Bound(p => p.DealerName).Title("Dealer Name").Width(100);
                columns.Bound(p => p.DealerId).Title("Dealer Id").Width(100);
                columns.Bound(p => p.RetailSales).Width(125);
                columns.Bound(p => p.WholesaleSales).Width(125);
                columns.Bound(p => p.LayawayPayments).Title("Deposit Payments").Width(125);
                columns.Bound(p => p.RentWithheld).Title("Rent").Width(125);
                columns.Bound(p => p.CommissionWithheld).Title("Commissions").Width(125);
                columns.Bound(p => p.ChargeCardFees).Title("Charge Fees").Width(125);
                columns.Bound(p => p.AssessmentWithheld).Title("Asessment").Width(125);
                columns.Bound(p => p.TotalPayout).Title("Total Payout").Width(125);
                columns.Bound(p => p.CheckNumber).Title("Check Number").Width(125);
            })
            .ToolBar(toolbar =>
            {
                toolbar.Excel();
                toolbar.Pdf();
            })
            .ColumnMenu()
            .Excel(excel => excel
                .FileName("CloseoutHistory.xlsx")
                .Filterable(true)
                .AllPages(true)
                .ProxyURL(Url.Action("ExcelExport", "Customer"))
             )
             .Pdf(pdf => pdf
                .AllPages()
                .AvoidLinks()
                .PaperSize("A4")
                .Scale(0.6)
                .Margin("2cm", "1cm", "1cm", "1cm")
                .Landscape()
                .RepeatHeaders()
                .Title("Closeout History")
                .TemplateId("page-template")
                .FileName("CloseoutHistory.pdf")
                .ProxyURL(Url.Action("PdfExport", "Dealer"))
            )
             .DataSource(dataSource => dataSource
                .Ajax()
                .Batch(false)                                               // We want to perform batch operations
                .PageSize(50)                                               // Set the page size
                .Events(events => events.Error("gridErrorHandler"))         // Define a function that gets called on an error
                .Read(read => read.Action("ReadCloseoutHistory", "Closeout"))  // The Read method in the controller
             )
    )
</div>

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 07 Apr 2017, 09:08 AM
Hello Randy,

This is not a known issue and I was not able to reproduce it in my testing scenario.

I used the same template and configuration options as in the provided code, and the application is working as expected:

http://dojo.telerik.com/EPUVif

I can assume that the issue occurs due to a custom logic which we may be overlooking at this moment. Please provide a fully runnable example and I will gladly assist.

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Randy
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or