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

Export to Multi-Page PDF

1 Answer 159 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 05 Jun 2015, 03:59 PM

I have a grid that will typically have anywhere between 50 to 400 rows. I figured out to export the grid to a one page pdf, however 100+ rows on a 1 page (Letter) pdf is unusable. How do I export to a multi-page pdf, or is that not an option?

 

If I specify PaperSize("Letter") I get a pdf with the top left section of the grid with the rest of the content simply cut-off. The PDF export functionality sounds really usefull, but unless I figure out how to do multiple-page exports, the possible uses will be extremely limited. Am I missing something?

 

 

@(Html.Kendo().Grid(Model)
    .Name("grid")
    .Columns(c =>
    {
        c.Bound(m => m.ExternalID).Title("ID");
        c.Bound(m => m.LocalID).Title("Local ID");
        c.Bound(m => m.GroupDate).Format("{0:d}").Title("Date")
            .ClientGroupHeaderTemplate("Date: #= kendo.toString(value, 'd') #   <button onclick='selectGridGroup(this);' class='btn btn-danger btn-sm'>Delete Items</button>");
        c.Bound(m => m.SubmitDate).Format("{0:d}");
        c.Bound(m => m.SettlementDate).Format("{0:d}").Title("Settle Date");
 
        c.Bound(m => m.FirstName);
        c.Bound(m => m.LastName);
        c.Bound(m => m.Company);
 
        c.Bound(m => m.SettlementAmount).Format("{0:C}").Title("Amount")
            .ClientGroupFooterTemplate("Sub-Total: #= kendo.toString(sum, 'C') #")
            .ClientFooterTemplate("Total: #= kendo.toString(sum, 'C') #");
        c.Bound(m => m.AdjustmentAmount).Format("{0:C}").Title("Adjustments")
            .ClientGroupFooterTemplate("Sub-Total: #= kendo.toString(sum, 'C') #")
            .ClientFooterTemplate("Total: #= kendo.toString(sum, 'C') #");
 
        c.Bound(m => m.InvoiceNumber);
        c.Bound(m => m.Description);
 
        c.Bound(m => m.TransactionStatus);
        c.Bound(m => m.Matched);.
        c.Command(m => m.Destroy()).Hidden();
    })
    .Groupable()
    .ToolBar(t => t.Pdf())
    .Pdf(p => p
        .AllPages()
        .Landscape()
        .PaperSize("Letter")
        .Title(@ViewBag.Title)
        .FileName(@ViewBag.Title + ".pdf")
        )
    .DataSource(d => d.Ajax()
        .ServerOperation(false)
        .PageSize(30)
        .Model(m => m.Id(i => i.Id))
        .Aggregates(a =>
        {
            a.Add(s => s.SettlementAmount).Sum();
            a.Add(s => s.AdjustmentAmount).Sum();
        })
        .Group(g => g.Add(a => a.GroupDate))
        .Destroy(r => r.Action("RemoveTransaction", "Report"))))

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 09 Jun 2015, 02:38 PM
Hello David,

I am not sure if I understand the problem when setting the paper size. Could you provide the generated pdf file and image of the original grid?
As for splitting the grid in separate pages - if paging should be enabled then you could use explicit page-breaks as demonstrated here.

Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or