How to set page margin in Reportviewer?

Here is my code working, but am I getting a blank print? I want to set the top edge to 0 when I don't have a logo as an image.

System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings(); pg.Margins.Top = 0; pg.Margins.Bottom = 0; pg.Margins.Left = 100; pg.Margins.Right = 50; System.Drawing.Printing.PaperSize size = new PaperSize(); size.RawKind = (int)PaperKind.A4Extra; pg.PaperSize = size; reportViewer1.SetPageSettings(pg); 
+6
source share
1 answer

you can do it using page options or something like this.

 var setup = frmReport.reportViewer1.GetPageSettings(); setup.Margins = new System.Drawing.Printing.Margins(1, 1, 1, 1); frmReport.reportViewer1.SetPageSettings(setup); 
+5
source

Source: https://habr.com/ru/post/954976/


All Articles