Jump to content
JasperReports Library 7.0 is now available ×

iliuta

Recommended Posts

This might be a recurrent question, but are there any possibilities in JasperReports to create PCL output without printing to a file using a PCL printer?

 

This could be useful in production environments, where printing is delegated to third party software which need input written in the native printer language with all processing instructions inside. No printer driver must be installed then on the server. The reporting tool generates the PCL file (or PS, ...) which is transmitted to the printer software via an external command. Large organizations usually work like this.

 

I saw that in JasperReports there is a JRGraphics2DExporter which uses a Graphics2D object to "draw" the report. On the other hand, the concurrent project FOP 0.93 provides a PCLGraphics2D (a subclass of Graphics2D) in charge of generating PCL output. I tried to pass a PCLGraphics2D instance to the JRGraphics2DExporter but if failed in a FOP's UnsupportedFeatureException. Inspecting the PCLGraphics2D code source, this class seems under heavy development. With some adaptations, I finally managed to produce a pcl file but its content doesn't seem reliable, since I don't speak currently neither PCL nor Graphics2D. But, this demonstrates that one possibility to produce PCL output is to implement a special Graphics2D.

 

So, Are there any plans to implement a PCL exporter for Jasper Reports?

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

There is no PCL exporter in JasperReports because there was no third party library able to produce it nor time for our team to learn PCL and implement it.

But I guess those who needed PCL support just went ahead using a PCL driver and did not have such a particular environment as you mentioned.

 

So I guess this is not something to see very soon in JR. Let's keep our fingers crossed that some good Graphics2D PCL implementation would be available soon.

 

Thanks,

Teodor

Link to comment
Share on other sites

Thanks for the answer, Teodor.

 

Well, I have some information that this is not such a particular environment. Some major banks in Europe work like that but they are using software able to generate PCL, such Streamserve (which is expensive software). Imagine what would that mean to install 10 000 printers in the system's "control panel" :) I am also quite sure that if you succeed to implement some reliable PCL exporter, that would be a great improvement for Jasper Reports and would bring it in concurrence with other software, perhaps not for large organizations as mentioned but smaller ...

 

But, what I wanted to say now is that at least it is quite easy to generate PS files with Jasper Reports since Sun provides an implementation of a StreamPrintService in charge of generating PS.

 

String psMimeType = DocFlavor.BYTE_ARRAY.POSTSCRIPT.getMimeType();

StreamPrintServiceFactory[] spsFactories = PrinterJob.lookupStreamPrintServices(psMimeType);

OutputStream os = new FileOutputStream("some path");

StreamPrintService psPrinter = spsFactories[0].getPrintService(os);

exporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE, psPrinter);

 

etc

 

(exporter is a JRPRintServiceExporter)

Link to comment
Share on other sites

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