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()

Comments

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>