Setting printer paper size in VB.Net for rdlc report
In order to change the default format (A4) of a report, you must change the report properties to accept a custom paper size.
Set PaperSize By GUI
Step 1
Open your report and right click (on the gray pane, not the report itself) to select "Report Properties"
Step 2
Choose Landscape for your orientation and select a custom paper size. Specify your width and height as well.
Programmatically Set PaperSize
- Paper Size should be the size in inches multiplied by 100
- Width: The width of the paper, in hundredths of an inch
- Height: The height of the paper, in hundredths of an inch
Here is the code I used to programmatically set a custom paper size to my report
ReportViewer1.PrinterSettings.DefaultPageSettings.PaperSize = new PaperSize("Custom", 650, 325)
**Note: Don't forget, you may need to use the code ReportViewer1.RefreshReport()
if it doesn't work.*
For more information, visit MSDN's PaperSettings.PaperSize page
Hamzeh Khater
Updated on July 06, 2020Comments
-
Hamzeh Khater almost 4 years
I built a report with a landscape orientation using VB.net 2010 and made the size 16.5 cm * 8.25 cm
When you print the report directly shows the size of the page A4 !!!
I need to provide the printer with a custom paper size. How can I make my report have a custom paper size?
-
Hamzeh Khater almost 11 yearsThanks Did it But this is not what I want to do I want to give an order that the printer paper size is 16.5 cm * 8.25 cm before print.
-
Alex almost 11 yearsIf you have those settings set, the printer will automatically accept it as a custom paper size and print it in that format (if it can).
-
Hamzeh Khater almost 11 yearsThank you Alex But I want do that by VB.Net code. I need customize printer setting (paper size) by code from my program.. Please download the sample project and try to help me uploadmb.com/dw.php?id=1379145264
-
Learning-Overthinker-Confused about 5 yearsCan you please help me with this question :stackoverflow.com/questions/55633350/…
-
Venu GoPal over 3 yearsHelped a lot... ..+1