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

[Solved] PDF Title

3 Answers 203 Views
Grid
This is a migrated thread and some comments may be shown as answers.
L
Top achievements
Rank 1
L asked on 22 Dec 2009, 12:16 PM
hi

I could not get the title printed on the PDF. How should i go about it? Thanks


Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand
        If e.CommandName = RadGrid.ExportToPdfCommandName Then
            IsPdfExport = True
            RadGrid1.ExportSettings.ExportOnlyData = False
            RadGrid1.ExportSettings.OpenInNewWindow = True
            RadGrid1.ExportSettings.Pdf.PageHeight = Unit.Parse("210mm")
            RadGrid1.ExportSettings.Pdf.PageWidth = Unit.Parse("297mm")
            RadGrid1.ExportSettings.IgnorePaging = True
        End If
    End Sub

 Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated
        If IsPdfExport AndAlso TypeOf e.Item Is GridHeaderItem Then
            RadGrid1.ExportSettings.Pdf.Title = "Unpaid/Partial Payment"
            Dim headerItem As GridHeaderItem = e.Item
            headerItem.Style("horizontal-align") = "left"
            headerItem.Style("font-size") = "10pt"
            headerItem.Style("background-color") = "lightgray"

            For Each cell As TableCell In headerItem.Cells
                cell.Style("text-align") = "left"
            Next
        End If
        If TypeOf e.Item Is GridDataItem Then
            Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)

            For Each cell As TableCell In item.Cells
                cell.Style("text-align") = "left"
                cell.Style("font-size") = "10pt"
                If e.Item.ItemType = GridItemType.AlternatingItem Then
                    e.Item.BackColor = System.Drawing.Color.LightYellow
                End If
            Next
        End If

        If IsPdfExport AndAlso TypeOf e.Item Is GridFooterItem Then
            Dim footerItem As GridFooterItem = e.Item
            footerItem.Style("horizontal-align") = "left"
            footerItem.Style("font-size") = "10pt"

            For Each cell As TableCell In footerItem.Cells
                cell.Style("text-align") = "left"
            Next
        End If
    End Sub

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 22 Dec 2009, 12:47 PM
Hello,

Try the following code in order to set the title for the page.

    RadGrid1.ExportSettings.Pdf.PageTitle = "Unpaid/Partial Payment"

-Shinu.
0
Accepted
Daniel
Telerik team
answered on 22 Dec 2009, 01:04 PM
Hello Lui,

Please use PageTitle for that purpose. The Title/Author/etc settings affect only the properties of the exported PDF file. You can see them by choosing File -> Properties in Adobe Reader.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
L
Top achievements
Rank 1
answered on 22 Dec 2009, 01:07 PM
Thanks
Tags
Grid
Asked by
L
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Daniel
Telerik team
L
Top achievements
Rank 1
Share this question
or