Using Custom Paper Sizes


06-19-2003, 12:00 PM
The manner in which an ActiveReport is rendered is dictated by the print driver. If the printer you've explicitly assigned for the report (or the default printer for the machine it's being run on if none was assigned) does not support the paper size you've chosen, ActiveReports will render the report on the printer's default paper size.

If you need your report to show on a custom paper size not supported by the printer, you can use the ActiveReports virtual print driver. The following code in the ReportStart event, or just before .Run is called, will allow you to do so, and to use any paper size:

.Document.Printer.PrinterName = ""

The PaperHeight and PaperWidth properties, which take a float value defined in inches, will have no effect unless you set the PaperKind property to Custom. Here is some sample code which can be placed in the ReportStart event, or just before .Run:

Me.PageSettings.PaperKind = Drawing.Printing.PaperKind.Custom
Me.PageSettings.PaperHeight = 2
'sets the height to two inches
Me.PageSettings.PaperWidth = 4
'sets the width to four inches