Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Website Design/Showcase (http://www.chiefdelphi.com/forums/forumdisplay.php?f=64)
-   -   Print a different page than current page? (http://www.chiefdelphi.com/forums/showthread.php?t=29958)

KathieK 13-08-2004 19:36

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?

mtaman02 14-08-2004 02:33

Re: Print a different page than current page?
 
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

evulish 14-08-2004 02:35

Re: Print a different page than current page?
 
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.

JohnBoucher 14-08-2004 06:30

Re: Print a different page than current page?
 
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.
Quote:

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()"

KathieK 14-08-2004 18:20

Re: Print a different page than current page?
 
Thanks for your suggestions. I agree about the Word document; we normally do not post docs in that format.

Aignam 19-08-2004 08:40

Re: Print a different page than current page?
 
Will this help you at all?
http://www.dynamicdrive.com/dynamici...printstyle.htm

KathieK 24-08-2004 20:25

Re: Print a different page than current page?
 
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!

KathieK 24-08-2004 20:26

Re: Print a different page than current page?
 
LOL, OK, I have no idea how to get that smiley face outta the code! But you can figure out what I meant!

rowe 24-08-2004 21:10

Re: Print a different page than current page?
 
Quote:

Originally Posted by KathieK
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:
Code:

<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

Joshua May 24-08-2004 21:11

Re: Print a different page than current page?
 
I think that this should work, but I haven't tested it:

Code:

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


All times are GMT -5. The time now is 14:29.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi