Paper Format and Margins Tutorial
In this tutorial you'll learn how to generate your report with other paper sizes than the default and also to set its margins.
    To change the paper format, you can use the function setPaper inside document's head. There are some ReportPaperFormats predefined at the core library in the package net.sf.nervalreports.core.paper.formats. If not defined, your report will be generated with the A4 as default. Let's change to use a Letter paper:

reportGenerator.beginDocumentHead();
reportGenerator.setPaper(Letter.getSingleton());
reportGenerator.endDocumentHead();
         
    If you want to use a paper not defined at the core library, you can inherit the ReportPaperFormat, implementing its abstract functions. The only mandatory are those who define the paper dimensions in millimeters (getWidthInMillimeters and getHeightInMillimeters). getHtmlName and getTeXName are only necessary if you plan to support HTML or LaTeX generation, in case the first one will be a string to be used at CSS @page size and the second one to be used at LaTeX documentclass.
    To change margins, you must call the function setMargins(int left, int top, int right, int bottom) also inside document's head. Each element is defined in terms of PDF units (an abstract measure used in terms of PDF creation), and defaults to {12, 12, 12, 12}. Let's see the document's head definition with the change to our margins:

reportGenerator.beginDocumentHead();
reportGenerator.setPaper(Letter.getSingleton());
reportGenerator.setMargins(20, 10, 20, 40);
reportGenerator.endDocumentHead();