Print a jasper report from specified client printer

Hi All,

I have included some jasper reports in my solution and wanted to print them directly by a printer in the client network. The code I used is as follows.

plugins.jasperPluginRMI.jasperReport(_server_name, _document_name, _printer_name, _printing_method, _document_params);

This worked properly in the development environment and the report was printed through the printer I specified.

But when I deployed the solution in a separate server and try to print a report from a printer in the client network, the report was printed from the default printer of the client machine, not the printer I specified in the code. And even when I gave the boolean value ‘true’ for the variable _printer_name it still went to the default printer without popping the print dialog.

Any help regarding this will be great full.

Thanks.

Buddhika_jayatissa,

Are you using smart client or webclient?
And which version of the jasper reports plugin do you use?

Can you also show the actual arguments to the print call?

In case of the smart client, the printer you want to print on, is it defined by that name on the servoy client machine?

Rob

Hi Rob,

I am using smart client.

the plugin version i use is 2.1.4.

And here is what i have passed in my arguments to the jasper plugin.

plugins.jasperPluginRMI.jasperReport(“sample_db”, “sample_label.jrxml”, “HP Deskjet D1500 series”, “print”, {client=Consumers});

When I gave these arguments the report was printed, but not from the printer “HP Deskjet D1500 series”, with the default printer of the client machine.

And also the name given for the printer is equal as it defined with the client machine printer.

Your assistance in this matter will be great.

Thanks,
Amal

Amal,

You can try the latest version of the plugin, but the printer logic does not seem to have changed much.

<Edit: replaced java code with servoy js code>

What if you run a bit of code in a solution that lists the printers on the client machine:

function listPrinters()
{
	var service = Packages.java.awt.print.PrinterJob.lookupPrintServices();
	var count = service.length;
	for (var  i = 0; i < count; i++)
	{
		application.output("Printer '" + service[i].getName() + "'");
	}
}

Rob

Hi All,

I have tried with the newer version of the jasper report. It seems to be working properly regarding the printing issue but have new issues now.

When I tried to open a report from the jasper viewer, the jasper viewer is opened but, the report is not displayed.

This is also regarding with the application server. It works clean with developer. Please help me on this issue.

:?

Thank you,

Amal

Buddhika_jayatissa:
Hi All,


When I tried to open a report from the jasper viewer, the jasper viewer is opened but, the report is not displayed.

Hi Amal,

Could you please provide some more details about this? What are the exceptions/errors in the log file or/and java console?

What kind of report are you trying to run (SQL-based or foundset-based)? And are you trying to use extra elements as images/fonts with it?

Also, if you are not already using the latest version of the plugin, could you please try to see if the issue is present with version 3.1_b3?

Regards,
Andrei

Hi Andrei / All,

Sorry for the lack of information given.

There were no exceptions or errors were occurred in the process. The whole process seems to be correct.

I am using the servoy jasper plugin version 3.0.0_a1. Also i have tried with several reports and some were having bar code fonts and also some were include images. After that i also tried to print a simple report where there no images or bar code fonts, but the result was the same.

I was able to save the file in jrprint type from the viewer(Still it doesn’t show the report). Then i wrote a simple app to print that file locally using netbeans and java where it printed correctly. So I think the problem is after building the jrprint file, not filling the report to the viewer.(with the method
jasperFillManager.fillReport() method)

I cant understand why this is happening.

My primary aim was to send a file to print from a specific printer in the client machine. And it was unable to do from the older version of servoy jasper plugin. (The older version did gave me the correct output in the jasper viewer).

I will attach an image of the output in my situation.

Any help will be realy appritiated as i am stuck with this for weeks now.

Thanks,
Buddhika

jrprinterror.doc (244 KB)

Hi Buddhika,

Could you please try to use version 3.1_b3 of the plugin and see if this solves the problem?
Try to download a drop-in version, for 3.1_b2 and just replace the servoy_jasperreports.jar file of 3.1_b2 with the one from 3.1_b3 and please check if the issue is still present.
The download site is http://code.google.com/p/servoy-jasperr … loads/list.

Regards,
Andrei

Hi Andrei,

It worked.
I just did as you said and was able to have a good output. Its working great for now. Anyway I will do some more testing on that.

Thank you very much, really grateful to your support !!!.

Amal