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

Export to Pdf Settings

3 Answers 126 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Felix
Top achievements
Rank 1
Felix asked on 13 Oct 2011, 08:13 AM
Iam having a problem while exporting grid data to pdf. The page Title is not formatting Html escape chacters so that iI would have part of the title in a newline.

This is my code.
grid.ExportSettings.Pdf.PageTitle = "All Transactions Report" + "\n" + Report printed by User;


I would expect my output to be

All Transactions Report

Report printed by User

But my pdf is outputting

All Transactions Report Report printed by User

Any help will be appreciated

3 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 13 Oct 2011, 10:10 AM
Hello Felix,

I'm afraid this is not possible since the PageTitle is rendered as a standard HTML title element - it does not support formatting and new lines. However, you could insert custom text and/or image at the top of the (first) page using the PdfExporting event.

Thanks,
Princy.
0
Felix
Top achievements
Rank 1
answered on 13 Oct 2011, 02:21 PM
Hi Guys,
Thats for your feedback, however am requesting that you provide me with a code sample on how to insert custom text at the top of the first page using the PdfExporting event.

Any help will be appreciated.

Regards,

Felix.
0
Daniel
Telerik team
answered on 18 Oct 2011, 07:08 PM
Hi Felix,

I hope this code-snippets will be a good starting point for you:
protected void RadGrid1_PdfExporting(object source, GridPdfExportingArgs e)
{
     e.RawHTML = "<span style='color: blue'>Report</span>" + "<br/>"
        + "Date:"  + DateTime.Now.ToString() 
        + e.RawHTML;         
}

Regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Felix
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Felix
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or