• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Printing at Client Side via MVC program

 
Ranch Hand
Posts: 225
Spring Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Salaam,

We are having one Java program which uses Java Print API, in addition to Jasper's iReport api for generating reports and printing it.

The program is called through Servlet while user clicks on the link.

This works fine, if we have installed Printer at Server side.

But, the question is how do we make it possible to do the printing at Client's Printer.

Have came to know about window.print(Javascript). But the problem is that,we dont want to print entire page.
We just want to print particular data (which we are storing in ArraList object).
Since, the data is confidential, we don't want to show it on browser also( either on load or on popup windows).

Anyone, can help to achieve the same ?

We have used the following stuff:
Java Print Service API (javax.print.*)
Jasper Reports API (net.sf.jasperreports.*)



---------------------

Regards

Baseet Ahmed

I am Momin InshaAllah
---------------------
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I was last faced with a problem like this, I thought to use Windows print sharing to expose the client printer to the network, then install the client printer on the server. The server could then print to the client printer as if it were directly attached. The project was canceled before I implemented it so I can't say how well that approach would work or if there are any other alternatives.
One concern I'd have is printing confidential data on a printer that could be unsupervised when the print occurs, but you have to address that concern according to your environment.
 
Baseet Ahmed
Ranch Hand
Posts: 225
Spring Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Joe,

The problem with approach mentioned by you(install the client printer on the server),is not possible(due to some security policy).
Hence we cannot go into that track.

The data contains password-like info which we don't want to show on the screen.Hence could not go for window.print(which prints current window box data).

Any other alternatives...

---------------------

Regards

Baseet Ahmed

I am Momin InshaAllah
---------------------
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only things that comes to my mind is using an Applet.
 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can applets access a local printer? Doubt it since this would be a point of attack, wouldn't it? If you have a client application, you might include some component that fetches the data and prints it, however. But this would have to be proof against others trying to fetch the same sensitive data unpermittedly.
 
Sheriff
Posts: 28346
97
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about using CSS to control that? I know you can use a "@media print" style with "display: none" to specify which elements should not appear in printed versions of the page. There's also the "@media screen" style, so probably you could make things invisible on the screen but visible in printed versions.
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Guido Sautter:
Can applets access a local printer? Doubt it since this would be a point of attack, wouldn't it?



It can if it is signed.
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul Clapham:
How about using CSS to control that? I know you can use a "@media print" style with "display: none" to specify which elements should not appear in printed versions of the page. There's also the "@media screen" style, so probably you could make things invisible on the screen but visible in printed versions.



That's a good idea. It still would allow the user to get the values on screen by looking at the page's source code, but depending on the scenario that might well be an acceptable risk.
 
We've gotta get close enough to that helmet to pull the choke on it's engine and flood his mind! Or, we could just read this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic