This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Client-side printing in JasperReports  RSS feed

 
Devarakonda Srikanth
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am using JasperReports in my application to generate reports. In my application there is one requirement such that if user clicks on print button the report is to be printed on the printer located on the client-side network. Can anyone tell me how to achieve this...

Thanks in Advance.
DNV Srikanth
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What kind of client is this - a web browser? A Java desktop application? In which format is the report generated?
 
Devarakonda Srikanth
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its a web-browser. In JasperReports a JasperPrint object will be passed to print the report.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Couldn't the user just use the Print menu item of the browser?
 
Devarakonda Srikanth
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a requirement in our application in which if a user clicks on pprint button only the report is to be printed. If the print menu item of browser is clicked we'll get the print-out of all other unwanted content of the page...right
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The obvious thing to do would be to generate a report that does not contain "unwanted content" (whatever that is).

One solution I've variously seen is to add a "Print" button that pops open a window with just the report. That would contain a "Print" button that calls the JavaScript print method, or print could be called directly from the onLoad handler.
 
Devarakonda Srikanth
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you just explain me how to do this the java-script???

Thanks in Advance
DNV Srikanth
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can find pages that call the print function all over the web, e.g. in this article at IBM developerWorks.
 
Devarakonda Srikanth
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Thanks for your reply.

But the link you have provided is no way related to print
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that article, look at the top right corner, which has a "Print this Page" link. Look at the source of that html page, you will see how the print operation is being called through javascript.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!