Jump to content
Changes to the Jaspersoft community edition download ×

batch print mode not respected in exporter

Recommended Posts

By: William Baker - wlbaker

batch print mode not respected in exporter

2006-07-11 07:04


Somewhere between JRGraphics2DExporter and JRPrintServiceExporter, the batch printing indicated by JASPER_PRINT_LIST is being lost. Only the first report in the batch is printed.


The JRPrintServiceExport should allow the printer to be selected once, then all the jobs in the print batch should be directed to that printer.


I looked at it in some depth and believe the problem is exclusively in the JRPrintServiceExport class. I suspect it is a 5-10 line fix, but I'm unsure about several aspects, including how the page range support should be handled. For my purposes, page range support is not an issue. I don't have a patch.




By: William Baker - wlbaker

RE: batch print mode not respected in exporte

2006-07-11 12:59

Not exactly a patch, but this is was an improvement, without respecting the page numbers very well.


In JRPrintServiceExporter, add two class variables:


int documentIndex = 0;

int relativePageIndex = 0;


In the print() routine, change the end-of-document check to:


setRelativePageIndex( pageIndex );

pageIndex = relativePageIndex;


if ( pageIndex < 0 ) {

return Printable.NO_SUCH_PAGE;







And add the following method to this class:


private void setRelativePageIndex(

int absolutePageIndex ) {

relativePageIndex = -1;

documentIndex = 0;


do {

jasperPrint = (JasperPrint)



int docPages = jasperPrint.getPages().size();


if( absolutePageIndex < docPages ) {

relativePageIndex = absolutePageIndex;




absolutePageIndex -= docPages;


} while( documentIndex < jasperPrintList.size() ) ;





// QED




By: Kimberly - kletco

RE: batch print mode not respected in exporte

2006-07-21 11:07

I am having this exact same issue. Are there plans to fix this soon?

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...