Print Multiple Pages per Sheet
In This Topic
The PrintMultiplePagesPerSheet sample demonstrates how you can print a document with multiple pages per sheet using the common PrintDocument class or PrintOptions class from .NET Framework. This sample project consists of the PrintMultiplePagesForm and the Invoice report.
Sample Location
Visual Basic.NET
https://github.com/activereports/Samples18/tree/main/API/Section/PrintMultiplePagesPerSheet/VB.NET
C#
https://github.com/activereports/Samples18/tree/main/API/Section/PrintMultiplePagesPerSheet/C#
Details
When you run this sample, you will see the PrintMultiplePagesForm with the Invoice report. On this form, you can select the number of pages to be printed on each sheet using the Select Number of Pages to Print on One Sheet ComboBox. You can also select from PrintMultiple Pages using PrintOptions API and PrintMultiple Pages using Custom Code tabs options and click the Print button on each of these tab to print the selected number of pages in one sheet.
Note: To run this sample, you must have access to the Nwind.db. The NWIND.db file can be downloaded from GitHub.
- PrintMultiplePagesForm: This form contains the ActiveReports Viewer control. The Dock property of the viewer is set to Fill so that it resizes automatically with the form at run time. The top section of Viewer contains a panel in which two tabs, ComboBox control, Label and two Print buttons are placed. ComboBox control lets you select the number of pages per sheet (2,4 or 8)and the Print button in PrintMultiple Pages using PrintOptions API and PrintMultiple Pages using Custom Code tab, print the selected number of pages in one sheet. The form also has two dialogs - dlgPrint and PrintDocument which assist in displaying the Print dialog box and printing the document.
Right-click and select View Code to see the code that displays the Invoice report when the form loads. Also the code demonstrates the different ways of printing a document - the Print button in PrintMultiple Pages using Custom Code tab uses the PrintDocument class and the Print button in PrintMultiple Pages using PrintOptions API tab uses the PrintOptions class.
- Invoice report: The Invoice report uses a PageHeader section, GroupHeader section, Detail section, GroupFooter section as well as a PageFooter section to display data in a Label control.
See Also