Jasperreport fit paper size B5

6.6k Views Asked by At

I have a jasper report template, the page size is A4, and now want to print it on B5 paper. What can I do to make the content not print out of the paper.

2

There are 2 best solutions below

0
On

You need to set pageWidth="501" and pageHeight="709" on jasperReport tag

ISO 216, as you can see the B5 is 176 × 250 in mm

In jasper report size is indicated in pixel (DPI 72)

pixels = (mm * dpi) / 25.4; //The DPI in jasper report is 72

The calculation will give width 499, jasper report uses as default 501, considering that the format has a 1,5 mm tolerance, either value will be fine.

Example with margin 20

<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="testSize" pageWidth="501" pageHeight="709" columnWidth="461" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="e1be95c1-b1c3-499e-b902-99cda67676af">
0
On

If you use TIBCO Jaspersoft Studio you can do this :

  1. Open the report.
  2. Right click inside the report :

Screenshot

  1. Set page format to B5 :

Format