Output as Postscript (Java)
Set up and configure output to Postscript from your
reporting application. Postscript files allow for archiving and dialog printing. Silent printing
depends on the availability of operating system printing commands such as
lp.
To use any of the renderer classes, you must import the
com.fourjs.report.runtime package:
import com.fourjs.report.runtime.*;Example
This code snippet uses the
PostscriptRenderer
class:// code snippet starts
String designFile = "OrderReport.4rp";
String outputFilename = "SalesList.ps";
FormatHandler handler = new FormatWriter(outputFilename);
PostscriptRenderer renderer = new PostscriptRenderer(handler);
FourRpLayouter report = new FourRpLayouter(designFile, renderer);
//Run the report
report.setDebugLevel(9);
// some code omitted - view full source in demo
report.runFromJAXBObject(data);
// open the file
File result = new File(outputFilename);
Desktop desktop = Desktop.getDesktop();
desktop.open(result);
// code snippet endsIn this example:
- A
FormatHandlerobject namedhandleris defined using theFormatWriterclass, taking the name of the output file as its input. - An object named
rendereris defined using thePostscriptRendererclass, takinghandleras input. FourRpLayouter report = new FourRpLayouter(designFile, renderer)creates the FourRpLayouter object for the specified report file that outputs a Postscript ( .ps) file with the provided name.
For the full list of methods for this renderer class, refer to the Genero Report Writer Java API documentation.