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

How to set page size while report export to PDF programmatically

1 Answer 485 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Chetan Pawar
Top achievements
Rank 1
Chetan Pawar asked on 21 Nov 2009, 07:43 AM
Hello All,

Is telerik reporting latest tool have feature to modify paper size (width/height) of exporting report to PDF file, generating using Code?
As in my requirement columns may be more to fit in general A4 paper size page. So I have to change the width or orientation of page (to landscape) while generating PDF file.

Please provide help.

Thank you in advance.

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 24 Nov 2009, 01:07 PM
Hello Chetan,

You can change both the orientation and PaperKind of the report through the exposed properties - PageSettings --> LandScape and PageSettings --> PaperKind. Page size is not involved in the layout calculations and is used only for paging, so consider the following code for altering the report definition width:

Dim oReport As Telerik.Reporting.Report = New TestReport
       oReport.PageSettings.Landscape = True
       oReport.PageSettings.PaperKind = Drawing.Printing.PaperKind.A3
       ' Change Report Width according to the new Page Size
       Dim w As Telerik.Reporting.Drawing.Unit
       If oReport.PageSettings.Landscape Then
           w = oReport.PageSettings.PaperSize.Height - oReport.PageSettings.Margins.Top - oReport.PageSettings.Margins.Bottom
           w = oReport.PageSettings.PaperSize.Width - oReport.PageSettings.Margins.Left - oReport.PageSettings.Margins.Right
       End If
       oReport.Width = w
       ReportViewer1.Report = oReport

Sincerely yours,
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.
General Discussions
Asked by
Chetan Pawar
Top achievements
Rank 1
Answers by
Telerik team
Share this question