PDA

View Full Version : Looking for info



Anonymous
08-28-2002, 03:37 AM
Hello,

I'm looking for a report generator for Java, and I've found the JFreeReports... Actually I'm totally a newbie, but I have a question:
* Is it possible to print directly the report, without showing it into the screen?


Thanks a lot,


Marc Casas

Anonymous
08-28-2002, 03:38 AM
Does it print well with Linux? It's because I've read that are problems/unimlemented functions in Java2 for linux... I use SDK 1.4.0

Anonymous
08-28-2002, 07:05 AM
Hi,

yes, you can print directly. Just create a PreviewPane, which implements the Pageable interface, and use a printjob to print the report:

PrinterJob pj = PrinterJob.getPrinterJob ();
pj.setPageable (reportPane);
if (pj.printDialog ())
{
try
{
pj.print ();
}
catch (PrinterException e)
{
showExceptionDialog ("error.printfailed", e);
}
}

There are 2 ways of creating a PreviewPane. The old way would be:

PreviewPane p = new PreviewPane (report, new G2OutputTarget (G2OutputTarget.createEmptyGraphics (), report.getDefaultPageFormat ()));

or in the cvs is a simplified version with uses only the report paramter:

PreviewPane p = new PreviewPane (report);

If you use the CVS version you will also need the BeanShell-Jar from www.beanshell.org to compile the package.

Have more fun,
said Thomas