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

Cover page for rad grid pdf output

1 Answer 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Clive Hoggar
Top achievements
Rank 1
Clive Hoggar asked on 10 Apr 2017, 01:43 PM

Hi guys

 

I have a nicely-styled pdf output from theRadGrid, and I would like to complete the report by including a text cover page within the pdf before the data. How can I do this. Personally, I could create the cover page separately and merge it with the data pdf but I really want to provide this function so non-IT people can create their own output in a single click.

Can you suggest how this could be done?

Thanks

Clive

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 13 Apr 2017, 08:54 AM

Hi Clive,

 I would suggest you use a table when exporting the content and place a page break to divide the cover page from the grid contents, i.e. 


protected void RadGrid1_PdfExporting(object sender, Telerik.Web.UI.GridPdfExportingArgs e)
{
    e.RawHTML =
        "<table width='300px'><colgroup><col /></colgroup><tr><td><b>Usuario:</b>" +
    "User" + "<b>" + "Report" + "</b>" + "report1<?hard-pagebreak?>" +
    "</td></tr></table>" + e.RawHTML;
}

Note that there are a few rules that should be followed when exporting HTML tables to PDF:
The table should define <colgroup> and <col> elements
The number of col elements should be equal to the number of the columns in the table body
Width in pixels (or another absolute units) should be set to the table.

At the last cell of your table you could set the page break tag <?hard-?>. This way all the content that follows will be moved on the next page.

You can also replace the table with another HTML element and use the page break to divide the cover page with the Grid contents.

Best regards,
Rumen
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
Clive Hoggar
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or