[izpack-users] Edding END statement to report send

Yossi Baram yossiba at eldat.com
Wed Mar 22 09:25:30 CET 2006


Hi,
Using the jasperreport I create stickers.
When I send the stickers(reports) to an A4 printer all stickers are
printed.
 
 
    public void print(JasperReport jasperReport,JasperPrint
jasperPrint,boolean rollMode){
     try
     {      

        
      PrintRequestAttributeSet aset = new
HashPrintRequestAttributeSet();
   
      //Check for orientation
  if(new
Byte(jasperReport.getOrientation()).toString().equals(PORTRAIT)){
    aset.add(OrientationRequested.PORTRAIT);
    }
   else{
    aset.add(OrientationRequested.LANDSCAPE);
   }
 

       aset.add(MediaSizeName.ISO_A9);
          
   JRAbstractExporter jaspExporter = new JRPrintServiceExporter();
   Map map = jaspExporter.getParameters();
  
   PrintService selectedPrintService =
ReportsManager.lookupDefaultPrintService(0,printerName);
   PrintServiceAttributeSet printAttributeSet = new
HashPrintServiceAttributeSet();
   printAttributeSet.addAll(selectedPrintService.getAttributes());
      jaspExporter.setParameter(JRExporterParameter.INPUT_FILE_NAME,
stickerFileName);
 
jaspExporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PAGE_D
IALOG, new Boolean(false));    
 
jaspExporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PRINT_
DIALOG, new Boolean(true));      
 
jaspExporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE_
ATTRIBUTE_SET, printAttributeSet); 
 
jaspExporter.setParameter(JRPrintServiceExporterParameter.PRINT_REQUEST_
ATTRIBUTE_SET, aset);
 
      try {
                jaspExporter.exportReport();
                logger.info("Sticker was printed at - " +
selectedPrintService.getName());
            } catch (JRException e1) {
             logger.error("Sticker was not printed  - " +
e1.getMessage());
            } 
            
            
      
     }catch (ModelException me) {
            logger.error(me.getMessage());
           
        } 
     catch (Exception e)
     {
      logger.error(e.getMessage());
     }
    }
 
 
When I send the print  to a roll printer I get an error saying "Paper's
imageable width is too small."
The problem is solved when I open a print dialoge (just for testing) and
I set the media size to - Auto End of Paper.
Where can I modify 'End of paper' in the code? without the need for a
dialog.
What is the attribute I should set?
 
Thanks
 
Yossi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.berlios.de/pipermail/izpack-users/attachments/20060322/795ccb01/attachment.html 


More information about the izpack-users mailing list