davidgarratt Posted June 18, 2014 Share Posted June 18, 2014 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(); [/code]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 Link to comment Share on other sites More sharing options...
hozawa Posted June 18, 2014 Share Posted June 18, 2014 Following thread may help you.http://stackoverflow.com/questions/10772240/how-to-change-page-format-in-runtimejasperreport Link to comment Share on other sites More sharing options...
davidgarratt Posted June 18, 2014 Author Share Posted June 18, 2014 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now