# On click, print target document - possible?



## danielsage98 (Aug 24, 2006)

I'm trying to make a link on a webpage, so that when you click the link, it prints the target document it links to. (So you click the 'Form' link, and the form comes out of your printer). Is this possible to do? Ideally if there's an HTML tag for it that'd be great; if not, can it be done in JavaScript?


----------



## gamerman0203 (Oct 28, 2005)

This is a link that will trigger the Print Box to pop up:

<A HREF="javascript:window.print()">Click to Print This Page</A>

It will not automatically print, but at least it gets the user to 'follow along'. Another thought that you will have to go through is setting up the page so that it will print out right. Setting up a special print page that is no wider than 700 pixels (I think, you'll have to experiment) should allow all content to fit between right and left print margins.


----------



## v-six (Sep 12, 2004)

You can also supply a different external css for print only.

the call would look something like this

<LINK rel="stylesheet" type"text/css" href="/css/stylesheetforprint.css" media="print">


----------



## grizzly_uk (Jul 28, 2006)

You can also specify an alternate document to print altogether...

Insert this into the HEAD of your document


```
<link rel=alternate media=print href="mydocument.doc">
```
Change *mydocument.doc* to your file, it can also be a .pdf, .txt and pretty much anything else.


----------

