Setting paper size and orientation

0

When I create a report using iReport I setup the page size etc. Does this mean than I don't need to set properties at runtime in Java as well ? I ask as I recently updated my java code which runs my reports by some of the reports printed incorrectly using only a small part of the page.

This is a fragment of my java code,

      exporter = new JRPrintServiceExporter();
 
         PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
      printRequestAttributeSet.add(new Copies(mod.getPrintCopies()));
 
 
         PrintServiceAttributeSet printServiceAttributeSet = new HashPrintServiceAttributeSet();
         printServiceAttributeSet.add(new PrinterName(JPrint.getPrinterShortName(JPrint.getPreferredPrinterQueueName()), null));    
 
 
      SimpleExporterInput simpleexporterinput = new SimpleExporterInput(jasperPrint);
 
      SimplePrintServiceExporterConfiguration configuration = new SimplePrintServiceExporterConfiguration();
      configuration.setPrintRequestAttributeSet(printRequestAttributeSet);
      configuration.setPrintServiceAttributeSet(printServiceAttributeSet);
 
 
      configuration.setDisplayPageDialog(false);
      configuration.setDisplayPrintDialog(mod.isPrintDialog());
 
 
      exporter.setExporterInput(simpleexporterinput);
      exporter.setConfiguration(configuration);
      exporter.exportReport(); 

I'm not sure if my code is missing something or there is a problem with the report definition (some of my reports are quite old now)

Thanks in advance

Dave

davidgarratt's picture
Joined: Sep 17 2013 - 8:13pm
Last seen: 3 weeks 3 days ago

1 Answer:

0
hozawa's picture
44999
Joined: Apr 24 2010 - 4:31pm
Last seen: 1 month 1 week ago

I understand what the link it saying in as much that you can override the page layout. My problem seems to be that I'm not getting the initial layout (default) from the report file itself. A report which should be A4 printed in a small square in the centre of the page with about 3inch borders on all sides.

davidgarratt - 5 years 1 month ago
Feedback