fintan
asked on
Printing multipage TIFFs from an applet.
Hi Folks,
I need to be able to print multipage tiffs from an applet (usning IE6.x and JDK1.4). The code below does work however it takes about 2-3 minutes per page. Some of the tiffs I need to print are 20 pages in size. As you can imagine waiting over an hour for a doc to print isn't going down very well. I've attempted turning off double buffering which stop huge spool files being created, however doesn't speed up the print. I've also disabled postscript printing on the printer (read somewhere that this can cause slow printing) but to no avail.
Any ideas? I need to get the printing speed around the same speed as printing directly from windows?
Document print
if (name.equals("buttonPrint" ))
{
//Custom button text
Object[] options = {"Print All Pages", "Print Selected Page", "Cancel Print"};
int n = JOptionPane.showOptionDial og(
null, "Would you like to print all the pages or the selected page?",
"Print", JOptionPane.YES_NO_CANCEL_ OPTION,
JOptionPane.QUESTION_MESSA GE,
null,
options,
options[2]);
if (n == 0)
{
try
{
// print all pages
// Open the file.
viewPanel.setDoubleBuffere d(false);
// Don't need to make second call to the URL to get Image
//Page p = PageGetter.getPage(printUR L);
Page p = annotationViewer.getImageS ource();
p.load(null);
while (p.getState() != Page.PAGE_STATE_LOADED)
{
Thread.sleep(500);
}
AnnotatedPagePrintable app = new AnnotatedPagePrintable(p, true);
// Create a PrinterJob.
PrinterJob pj = PrinterJob.getPrinterJob() ;
// Set the margins.
PageFormat pf = pj.defaultPage();
// Now Print the page.
pj.setPrintable(app, pf);
pj.print();
viewPanel.setDoubleBuffere d(true);
}
catch (Exception ex)
{
// Something went wrong.
ex.printStackTrace();
}
}
else if (n == 1)
{
annotationViewer.printImag e();
}
}
I need to be able to print multipage tiffs from an applet (usning IE6.x and JDK1.4). The code below does work however it takes about 2-3 minutes per page. Some of the tiffs I need to print are 20 pages in size. As you can imagine waiting over an hour for a doc to print isn't going down very well. I've attempted turning off double buffering which stop huge spool files being created, however doesn't speed up the print. I've also disabled postscript printing on the printer (read somewhere that this can cause slow printing) but to no avail.
Any ideas? I need to get the printing speed around the same speed as printing directly from windows?
Document print
if (name.equals("buttonPrint"
{
//Custom button text
Object[] options = {"Print All Pages", "Print Selected Page", "Cancel Print"};
int n = JOptionPane.showOptionDial
null, "Would you like to print all the pages or the selected page?",
"Print", JOptionPane.YES_NO_CANCEL_
JOptionPane.QUESTION_MESSA
null,
options,
options[2]);
if (n == 0)
{
try
{
// print all pages
// Open the file.
viewPanel.setDoubleBuffere
// Don't need to make second call to the URL to get Image
//Page p = PageGetter.getPage(printUR
Page p = annotationViewer.getImageS
p.load(null);
while (p.getState() != Page.PAGE_STATE_LOADED)
{
Thread.sleep(500);
}
AnnotatedPagePrintable app = new AnnotatedPagePrintable(p, true);
// Create a PrinterJob.
PrinterJob pj = PrinterJob.getPrinterJob()
// Set the margins.
PageFormat pf = pj.defaultPage();
// Now Print the page.
pj.setPrintable(app, pf);
pj.print();
viewPanel.setDoubleBuffere
}
catch (Exception ex)
{
// Something went wrong.
ex.printStackTrace();
}
}
else if (n == 1)
{
annotationViewer.printImag
}
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Jezzz.... That's tragic. It's not like the files are big or anything. A single page is less than 60k and the multipage doc is around 500K.
Is converting the image to another format not likely to cause the same problem when I attempt to print?
Using the windows app isn't really a runner. The client went for the browser based app because of the ease of deployment etc. I had thought about a windows based print server on one machine, but the end users are spread out over a few building with about 100 printers...
Cheers,
Fintan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Cavalmi,
I tried the snowbound stuff, but those guys sure know how to charge for the toolkit. It was gonna cost some where in the region of £6000 - £8000 depending on the configuration and (I think) there was a per seat licensing charge for end users.
I'll have a hunt for a pdf to postscript lib and see if it does the job
Cheers,
Fintan
ASKER
I haven't been able to find a tiff2ps library... but as cavalmi and tim have pointed out it appears to be an issue with the JDK... and I'll probably have to live with it...
Cheers,
Fintan
Cheers,
Fintan
Hopefully it will be sorted out in 1.5... I have heard rumours that it is much faster with java2d...not tested it yet though...
Good luck!!
Good luck!!
http://forum.java.sun.com/thread.jsp?thread=368042&forum=54&message=1554932
Hmmmm...