PDA

View Full Version : Problem? Browser Client needs to print without viewing doc.


njmj0910
08-20-2002, 01:41 PM
How to solve this problem stated in subject line. I need to use Java preferably in this solution.

x_goose_x
08-20-2002, 02:15 PM
Try something like:

prntwin = window.open("page.htm","","left=3000,top=3000");

prntwin.document.print();

setTimeout("prntwin.close()",15000);

njmj0910
08-20-2002, 02:20 PM
but that would still allow the user to view the document even if it's for a second. One of the requirement is to have the user not view the document at all. It is a security issue as well.

thanks for your help.

x_goose_x
08-20-2002, 02:43 PM
It's far off their screen. They can't see it. But any way you write the script the user can just open the file and read the url to the file. Javascript has nothing in the way of security.

Roy Sinclair
08-20-2002, 02:51 PM
As long as your users have modern browsers this will work:

<style type="text/css">
@media screen { body { display: none ; }
@media print { body { display: block ; }
</style>

Of course there won't be anything but a blank screen to look at...

brothercake
08-20-2002, 02:53 PM
for IE only, you might be able to use the execCommand method to call and then print a remote file. check out http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/execCommand.asp