Jump to content
JasperReports Library 7.0 is now available ×

Bug Report Jasper Reports/CUPS


thomas_ramapuram

Recommended Posts

Hi,

Which would be a good mailing-list, Forum to report bugs on Jasper Reports/Cups? I thing there is a bug Printing Jasper Reports. I am not sure if the bug is in Jasper Report, Java Print API or CUPS but I'm sure there is a bug because, the same code works perfectly on Windows. It works with quirks on an earlier version of CUPS. But it does not work on the current version of CUPS.

If this is the right forum. I could post all my code and the errors I get here.

 

Regards,

Thomas Ramapuram.

Link to comment
Share on other sites

  • 6 months later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

This is due to a known bug in Sun's Java print system that makes it not work with CUPS:

 

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4900425

 

 

Consider the program at the bottom of this post (which is code taken out of JPPrintServiceExporter.java). When run on Linux (Fedora Core 6), it prints false twice, which means that it will never find the (properly installed) printers. When run on Mac OS X Tiger (which also uses CUPS), it prints false the first time, but true the second.

 

Workarounds:

1. On Mac OS X, run the code snipped down below once at the start of your application. This should work, but I haven't tried it yet.

2. For Linux, modify JPPrintServiceExporter.checkAvailablePrinters() to always return true on Linux. This will required using a modified version of JasperReports, of course. :-(

 

Hope this helps.

-- Bob

 

import javax.print.*;

import javax.print.attribute.*;

import javax.print.attribute.standard.*;

 

public class PrintersTest

{

// artf1936

public static boolean checkAvailablePrinters()

{

PrintService[] ss = java.awt.print.PrinterJob.lookupPrintServices();

for (int i=0;i<ss.length;i++) {

Attribute[] att = ss.getAttributes().toArray();

for (int j=0;j<att.length;j++) {

if (att[j].equals(PrinterIsAcceptingJobs.ACCEPTING_JOBS)) {

return true;

}

}

}

return false;

}

public static void main(String[] args)

{

System.out.println(checkAvailablePrinters());

System.out.println(checkAvailablePrinters());

}

}

Link to comment
Share on other sites

  • 3 months later...

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...