7

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?

Link: http://www.uploadmb.com/dw.php?id=1379145264

Alex
  • 4,821
  • 16
  • 65
  • 106
Hamzeh Khater
  • 81
  • 1
  • 1
  • 2

3 Answers3

8

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"

Report Properties

Step 2

Choose Landscape for your orientation and select a custom paper size. Specify your width and height as well.

Paper size


Programmatically Set PaperSize

  1. Paper Size should be the size in inches multiplied by 100
  2. Width: The width of the paper, in hundredths of an inch
  3. 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

Alex
  • 4,821
  • 16
  • 65
  • 106
  • Thanks 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. – Hamzeh Khater Sep 15 '13 at 03:01
  • If 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). – Alex Sep 15 '13 at 14:00
  • Thank 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 http://www.uploadmb.com/dw.php?id=1379145264 – Hamzeh Khater Sep 16 '13 at 02:27
  • Can you please help me with this question :https://stackoverflow.com/questions/55633350/how-to-show-report-data-in-center-of-rdlc-report – I Love Stackoverflow Apr 15 '19 at 15:17
  • Helped a lot... ..+1 – Venu GoPal Jan 25 '21 at 17:27
0

I solved the issue by setting the report properties - setting up page size by inches, after that setting up the width 3.0in and height 8.3in the problem is solved.

Zoe
  • 27,060
  • 21
  • 118
  • 148
wael mrabet
  • 109
  • 1
  • 9
-1

Dim page As XmlElement = AddElement(reportSection, "Page", Nothing)

        'landscape
        AddElement(page, "PageHeight", "8.5in")
        AddElement(page, "PageWidth", "11in")
Irina
  • 1