Create multi-page ISO reports (C#)
For reports printed on ISO and JIS-sized pages, you can configure the output to print several logical pages per physical page.
Example
This code snippet uses properties and methods from the
MultiPageMapper
class:// start code snippet
String designFile = "OrderReport.4rp";
String outputFilename = "PDFoutput.pdf";
FormatHandler handler = new FormatWriter(outputFilename);
PDFRenderer renderer = new PDFRenderer(handler);
//Defining the Multipage
PXMLConsumer multiPageLayout = new PXMLLayouter(renderer);
MultiPageMapper myMultiPageMapper = new MultiPageMapper(multiPageLayout);
myMultiPageMapper.isoNumber = 4;
myMultiPageMapper.pageExponent = 2;
myMultiPageMapper.portrait = true;
myMultiPageMapper.paperLeftMargin = "2mm";
myMultiPageMapper.paperRightMargin = "2mm";
myMultiPageMapper.paperTopMargin = "2mm";
myMultiPageMapper.paperBottomMargin = "2mm";
multiPageLayout = myMultiPageMapper;
FourRpProcessor report = new FourRpProcessor(designFile, multiPageLayout);
//Run the report
report.setDebugLevel(9);
// some code omitted - view full source in demo
report.runFromSerializable(data);
// open the file:
System.Diagnostics.Process.Start(outputFilename);
// stop code snippetThe
MultiPageMapper class is used to specify how many
logical pages are placed on a physical page, as well as page sizing issues.Note:
For MultiPageMapper, you must use the FourRpProcessor; you cannot use the shortcut.
- The
isoNumberproperty specifies the ISO value of the physical page. In our example,4specifies an A4 ISO page size. - The
pageExponentproperty specifies the number of logical pages to place on the physical page, as an index of 2. In our example,myMultiPageMapper.pageExponent = 2specifies that 2*2 report pages, or 4 logical pages, will print on each physical page. IfmyMultiPageMapper.pageExponent = 3is specified, then 2*2*2 report pages, or 8 logical pages, will be printed on each physical page. - The
portraitproperty sets the orientation of the logical pages of the report. When set totrue, the logical pages are portrait. - The
paperLeftMargin,paperRightMargin,paperTopMarginandpaperBottomMarginproperties set the margins for the physical page. In this example, the margins are set for 2mm on all sides.
Once the MultiPageMapper object is defined, it is used to set the value for the
PXMLConsumer object, which then becomes the input for the
FourRpProcessor.
For the full list of properties and methods for this renderer class, refer to the Genero Report Writer .NET API documentation.