Forum Moderators: open

Message Too Old, No Replies

Printing a Document direct from a link.

Particularly word files

         

limbo

1:09 pm on Apr 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Afternoon all (gmt)

Does anyone know if it's possible to assign a action to a link so when clicked the target page/document, in this case a Word doc, prints without opening (or opens - prints - then closes automatically) There is no worry of users not having access to word 2000 because this is a problem with our intranet.

Maybe Jscript?

Ta

Limbo

ShawnR

2:03 pm on Apr 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Limbo

I haven't tried it, but I think the following should work (given that it sounds like your environment is a Microsoft one, so your users have IE6+):

For each doc you wish to print, create a small html file (say file_to_print.html) with the following in the <head> section:

<link rel=alternate media=print href="file_to_print.doc">

and in the onload() function, call

window.print()
and then close itself.

Then in your main html file, have the <a> tag open up file_to_print.html in a new window using 'target=...'

Depending on what you have on the server side, you may be able to make the solution more elegant (e.g. have a perl script create the small html file for you on the fly, so you don't have to create one for each doc to be printed).

There may be more elegant solutions, so I'd be interested in any other ideas.

Shawn

RonPK

4:33 pm on Apr 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I found this thread that might be interesting:
[webmasterworld.com ]

Prepare to enter the world of vbscript and the automation object...

limbo

11:49 am on Apr 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Guys

I'm feeling a little out of my depth :)

<note to limbo> Add Perl to "TO LEARN" list </note to limbo>

I'll see if the budget(boss) will stretch to some training.

aspdaddy

11:58 am on Apr 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Automating Word on the server can be resource heavy and also the clients will not access to the servers monitor/printer etc.

If users have IE, you can use the same object model, automating it on the client with vbscript
[webmasterworld.com...]

ShawnR

12:09 pm on Apr 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Limbo

I am sure I speak for everyone when I say sorry to hear that any of our responses made you feel out of depth. That was not the intent... quite the opposite. So, if any of our responses were too cryptic, please just ask for clarification of the bits that you felt uncomfortable about. We all get a kick out of helping someone solve a problem (and teaching and learning at the same time). We certainly don't get a kick out of making anyone feel out of depth.

Shawn

RonPK

2:18 pm on Apr 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello Limbo,

The combination of MS IE and MS Office offers some interesting possibilities, especially for intranet applications. The link aspdaddy gave should get you going.
It is possible to open and print a Word document automatically by clicking on a link, or even just by loading a page in the browser. You can even use the mailmerge-options of Word to print a letter with name and address info from the web page. But you don't want all that to happen when you're surfing the web, so MS has been so kind as to include some security barriers for this kind of scripting. You'll have to modify some settings in the users' browsers in order to get things working properly - which settings depends on the version of IE.

Hope this helps!