Jasper report batch print

Questions and answers on developing, deploying and using plugins and JavaBeans

Jasper report batch print

Postby deezzub » Mon Aug 04, 2014 11:48 am

I have foundset based Jasper report.:

Code: Select all
function sendToPrinter( ) {
   
   var reportParams = {
         comRegExtr   :   '',
         serverURL   :   ''
      },
      selectedIndex = 1;
   ;
   
   if ( tmpid ) {
      
      reportParams.serverURL = serverPaths.serverUrlApplPath;
      
      if ( aufkopf_to_mandpara && aufkopf_to_mandpara.hra ) {
         reportParams.comRegExtr = aufkopf_to_mandpara.hra;
      }
      selectedIndex = foundset.getSelectedIndex( );
      foundset.addFoundSetFilterParam( 'tmpid', '=', tmpid, 'document tmpid filter' );
      foundset.loadAllRecords( );
      plugins.jasperPluginRMI.runReport( foundset, buhaFakturaReport, true, "print", reportParams, docDefGlo.getDocumentLanguage( r_sprache ) );
      foundset.removeFoundSetFilterParam( 'document tmpid filter' );

      foundset.loadAllRecords( );
      foundset.setSelectedIndex( selectedIndex );
   }
}


where I pass print to the runReport function. Now, I need to generate this report in batch function, but for every runreport call, I get a print dialog. How can get only one print or no print dialog for generating the report for couple of records?
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany

Re: Jasper report batch print

Postby jasantana » Mon Aug 04, 2014 12:09 pm

The third parameter in the runReport method can be:
a) Output file name and path
b) Boolean value for print dialog to appear
c) Printer name to print the file

If it is null and the fourth parameter is "print" the report will be printed in the default printer. If you are running a batch process it'll run from the server so will be the server default's printer.

Hope this helps
Best regards,
Juan Antonio Santana Medina
jasantana@nephos-solutions.co.uk
Servoy MVP 2015
Servoy 6.x - Servoy 7.x - Servoy 8.x - MySQL - PostgreSQL - Visual Foxpro 9
User avatar
jasantana
 
Posts: 555
Joined: Tue Aug 10, 2010 11:40 am
Location: Leeds - West Yorkshire - United Kingdom

Re: Jasper report batch print

Postby deezzub » Mon Aug 04, 2014 12:23 pm

Thanks Juan. :)
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 7 guests