Jump to content
Changes to the Jaspersoft community edition download ×

defining a printer when printing the jasper


Recommended Posts

By: viji - vijinarayanan

defining a printer when printing the jasper

2005-07-19 00:58

if i click printer for jasper report,it prints on the server's default printer.it is possible to print the reports on the other network printer (client printers)?

 

if so,i had the program to list the printers in the server,but i don't know to pass the report to the client printer?help me to do this.

 

thanks in advance.

 

viji.

 

 

By: Flavius Sana - flavius_sana

RE: defining a printer when printing the jasp

2005-07-19 04:43

A solution to your problem is to set the parameter

JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG to true. Something like:

 

JRPrintServiceExporter exporter = new JRPrintServiceExporter();

....

exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG, Boolean.TRUE);

 

This will display the print options dialog and you can choose the printer (and other printing options).

 

 

Regards,

Flavius

 

 

 

By: Craig O'Shannessy - shanness

RE: defining a printer when printing the jasp

2005-07-19 05:27

What about programatically? I haven't needed to do this yet, but will very soon, and can't find anything in the API to print to anything but the default printer.

 

e.g.

 

JasperPrintManager.printReport(jasperInvoiceReport, false);

 

This printing is being done from EJB SessionBeans, on the server, no user available to make selections.

 

Am I missing something obvious?

 

Craig

 

 

By: Teodor Danciu - teodord

RE: defining a printer when printing the jasp

2005-07-19 06:40

 

Hi,

 

If you want to print to a specific network printer, you could

specify the name of the printer as the value for the

javax.print.attribute.standard.PrinterName attribute

in the map of printer service attributes that you pass

to the JRPrintServiceExporter.

 

Check the supplied "printservice" sample and you'll

see two lines that are commented out. Those were

for specifying the printer name.

 

I hope this helps.

Teodor

 

 

 

By: Craig O'Shannessy - shanness

RE: defining a printer when printing the jasp

2005-07-19 17:37

Excellent, thanks very much Teodor, this is exactly what I was after.

 

Craig

Link to comment
Share on other sites

  • 2 months later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

In this situation i found a bug (maybe)

 

We have two printers: the default printer and a network printer. These printers have a diferent page configuration (very diferent).

 

I select (with the code posted in this thread) the no defalut printer, and when i print the report is printed with the default printer configuration.

 

This is a bug or a mistake ?

 

Regards

 

Platform: Windows XP, JRE 1.5.0_09, JasperReports 1.2.7

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