Print a different page than current page?

I have an html page describing an event we will be holding, “description.html”. I have a Word document (which I can convert to PDF or html format) which is the registration form for the event.

I would like to create a link at the bottom of “description.html” that says, “Click here to print the registration form.” I want the viewer to be able to click on the link and have the registration form automatically go to the printer, without having to open it first.

I found a javascript that will print a different page than the current page, but only if you go to FILE, PRINT in the browser. I would really like to do it with a link or a button.

I was told you can accomplish this with the use of framesets, but I couldn’t get it to work right.

Can anyone help?

u want it to go strait to the printer?

I know that if u put a link on description.html to the form ure placing there as well it will ask u to save or open it. from either or both u can then open and print the page

as for making it go straight to the printer i’m not sure maybe IM brandon and maybe he can assist

You want this button to automatically send the page to the printer without loading on the screen? As far as I know, that’s not possible. And I wouldn’t really recommend it if it is. It’s nice to see what you’re printing before-hand to see what it is, how long it is, etc. I’d either go with a PDF or an HTML file for an online doc. I’m a bit opposed to using the MS Word format on a website since not everyone has Word and the formating of the page is more like to be off than with HTML or a PDF.

I found this at HtmlGoodies.
It doesn’t do exactly what you want, but it does show an onload command that might work for you.

And, if you really want to be annoying, off of just about any Event Handler like this, adding onLoad will force a print request when the page loads:

onLoad=“window.print()”

Thanks for your suggestions. I agree about the Word document; we normally do not post docs in that format.

Will this help you at all?
http://www.dynamicdrive.com/dynamicindex9/printstyle.htm

I figured out how to do it.

In the current document, in the HEAD tag, type the following code (where href= refers to the different page you want to print without loading to the screen first):

<link rel=“alternate” media=“print” href=“different_page.html” />

<script>
function printWindow(){
bV = parseInt(navigator.appVersion)
if (bV >= 4) window.print()
}
</script>

and then in the BODY of the current document type:

<a href=“javascript:printWindow()”>Print The Different Page</a>

(I wanted a link to print and not a print button).

I know this won’t work for every browser, but it will work for my purposes. Thanks to everyone who replied with suggestions!

LOL, OK, I have no idea how to get that smiley face outta the code! But you can figure out what I meant!

use the code]/ code] (spaces added so it wouldn’t actaully do it)

if you want to add another line in your code you can have it so theres a link to the page you want printed if the browser doesnt support it.

it being this:


<link rel="alternate" media="print" href="different_page.html" />

<script type="text/javascript">
function printWindow(){
bV = parseInt(navigator.appVersion)
if (bV >= 4) {
  window.print()
}
else {
  window.location="different_page.html";
}
</script>

<a href="javascript:printWindow()">Print The Different Page</a>

think that should work, you might have to debug but thats the general idea

I think that this should work, but I haven’t tested it:

<a onClick="window.print(http://www.domain.com/pagetoprint.html)">