Set Default Page Setup in ReportViewer

Dim pg As New System.Drawing.Printing.PageSettings()
    pg.Margins.Top = 0
    pg.Margins.Bottom = 0.25           
    pg.Margins.Left = 0           
    pg.Margins.Right = 0

Dim size As System.Drawing.Printing.PaperSize = New PaperSize("custom", 300, 200) 'the custom size 3in x 2in
    pg.PaperSize = size
    pg.Landscape = False ' set the print orientation to Portrait
    ReportViewer1.SetPageSettings(pg)
    ReportViewer1.SetDisplayMode(DisplayMode.PrintLayout)  ' set the default view to Print Layout
    ReportViewer1.RefreshReport()

Jon Raz

Post a Comment

Previous Post Next Post