How_to_execute_the_sample
Here is where you can download a patched version of jasperreport 1..2.6 which contains the postscript exporter :http://rieps.free.fr/jrps/jasperreports-1.2.6-RIEPS.tgz
There is the sample : ./demo/samples/generatingPS/
Here is the postscript creation code from the sample :
------------------------------------------------------- File sourceFile = new File(fileName); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".ps"); JRPostscriptExporter exporter = new JRPostscriptExporter(); com.rie.rieps.engine.Job job = com.rie.rieps.engine.Job.createPSTopLeftOriginJob(new java.io.FileOutputStream(destFile), 595, 842); job.setAvailableDeviceFont(new String[]{"Times-Roman", "Helvetica", "Courier", "Times-Italic", "Times-Bold", "Helvetica-Bold"}); job.askForUnmappedAWTFont(true); job.echoFontMapping(true); com.rie.rieps.engine.image.ImageFactory imgf = com.rie.rieps.engine.image.ImageFactory.createSmallGrayImageFactory(com.rie.rieps.engine.image.SmallGrayImage.CONVERT_MODE_AVERAGE); job.open(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRPostscriptExporterParameter.PS_JOB, job); exporter.setParameter(JRPostscriptExporterParameter.PS_IMG_FACTORY, imgf); exporter.exportReport(); System.err.println("Postscript creation time : " + (System.currentTimeMillis() - start)); System.exit(0); -----------------------------------------------------------
Here is how I execute the sample :
$:.../jasperreports-1.2.6/demo/samples/generatingPS$ export CLASSPATH=$(echo $(find ../../../lib/ -name "*.jar") | sed -e "s/ /:/g"):../../../dist/jasperreports-1.2.6.jar:. $:.../jasperreports-1.2.6/demo/samples/generatingPS$ java6 -cp $CLASSPATH StyledTextApp -Tfill -FStyledTextReport.jasper Filling time : 3172 $:.../jasperreports-1.2.6/demo/samples/generatingPS$ java6 -cp $CLASSPATH StyledTextApp -Tps -FStyledTextReport.jrprint Arial=Times-Bold,0.0,0.0,0.0 0.0 cos mul,0.0 0.0 sin mul,0.0 0.0 sin neg mul,0.0 0.0 cos mul,0,0 Postscript creation time : 9111 $:.../jasperreports-1.2.6/demo/samples/generatingPS$ java6 -cp $CLASSPATH StyledTextApp -Tpdf -FStyledTextReport.jrprint PDF creation time : 2717
Revision History
ypiel - 20/9/07 - 10:08 am