This sample project implements the class MultipagePrintDocument that inherits from System.Drawing.Printing.PrintDocument to print multiple pages of a document per sheet.
The constructor of MultipagePrintDocument accepts an instance of TXTextControl.TextControl that is used to create the page thumbnails in the printing process, the number of pages per sheet and a boolean value to specify whether the light gray border should be printed or not between the pages.
The overridden method OnPrintPage contains the main logic and controls the printing process. Based on the specified number of pages, the width and height of the available columns and rows per sheet are calculated and for each page, a thumbnail image is created using TX Text Control's GetImage method. The image is scaled to the width of the defined columns to create a multipage document.
The method GetThumbnailValuePair returns the required grid size based on the given number of pages per sheet:
This code shows how to call the MultipagePrintDocument and how to open a PrintPreviewDialog with the results:
Download the sample from GitHub and test it on your own.