smojo Posted April 8, 2010 Share Posted April 8, 2010 Hello,Is there a way you can specify a paper type in a Jasper Report (or java).Example: label, plain, envelope, ... Thanks in advance Link to comment Share on other sites More sharing options...
shekhar Posted April 9, 2010 Share Posted April 9, 2010 Hi,Yes, please take look at this class MediaSize for more details. You can customize your media size as you want or you can use standard ISO sizes. i hope the following code could help you. :)JasperDesign jasperDesign = JRXmlLoader.load(filename.jrxml); JasperReport jasRep = JasperCompileManager.compileReport(jasperDesign);JasperPrint jasPrnt = JasperFillManager.fillReport(jasRep, null ,con);PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();MediaSizeName mediaSizeName = MediaSize.ISO.A4.getMediaSizeName();printRequestAttributeSet.add(mediaSizeName);JRPrintServiceExporter exporter = new JRPrintServiceExporter();exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);exporter.setParameter(JRPrintServiceExporterParameter.PRINT_REQUEST_ATTRIBUTE_SET, printRequestAttributeSet);exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG, Boolean.FALSE);exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PRINT_DIALOG, Boolean.FALSE); exporter.exportReport();Post Edited by rshekhar2000 at 04/09/2010 09:02Post Edited by rshekhar2000 at 04/09/2010 09:03 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