Connecting Tech Pros Worldwide Help | Site Map
Reply
 
LinkBack Thread Tools Search this Thread
  #1  
Old August 16th, 2008, 05:26 PM
meenakshia's Avatar
Member
 
Join Date: Jun 2008
Location: delhi,india
Age: 31
Posts: 33
Default problem with the printing of alternative pages

hi forum
i m trying to print two different pages as soon as the form is saved.

i tried to use this command
<A HREF="javascript:window.print()">Print 1st Page</A>
<A HREF="javascript:window.print()">Print 2nd Page</A>

but i was unable to use the link command to force the printer to print the two other pages

print 1st page should print cust1.htm
and print 2nd page should print cust2.htm

any ideas how to go ahead for the same?
smile always
anand
Reply
  #2  
Old August 17th, 2008, 06:26 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,964
Default

window.print() prints the current page. Which page is this code in?
Reply
  #3  
Old August 24th, 2008, 05:18 AM
meenakshia's Avatar
Member
 
Join Date: Jun 2008
Location: delhi,india
Age: 31
Posts: 33
Default

hi
thanks for ur reply
well yes i have used the window.print() but it prints a current page
what i want is that if i have page 1.html open
in this page i have 2 links
1st link when clicked will print 2.html page
and 2nd link when clicked will print 3.html page
can you suggest me a way to do so?
i came across an idea that maybe i open both the pages as popup and in those pages use onload to print
is this the right way?
thanks
anand
Reply
  #4  
Old August 25th, 2008, 12:14 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,964
Default

Yes, that could work but then you'd have a window open that will need to be closed by the user. An alternative is to use print stylesheets to print only what is required - a kind of "Print-friendly page" using CSS. The way this could work is if you load the stylesheet for the corresponding linked page when the link is clicked.
Reply
  #5  
Old September 2nd, 2008, 06:42 PM
meenakshia's Avatar
Member
 
Join Date: Jun 2008
Location: delhi,india
Age: 31
Posts: 33
Default

hi thanks for reply
i cud not understand what u meant to say.
can u suggest me with some example
thanks
anand
Reply
  #6  
Old September 3rd, 2008, 11:22 AM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,964
Default

It was a suggestion, but it may not work depending on the files to be printed and could actually be quite complex. You load a print stylesheet initially for link 1. This could be achieved by having the linked page loaded in the main page but hidden and the print stylesheet shows it and hides the rest of the content. If link 2 is clicked, it changes the stylesheet to the link 2 stylesheet (which shows the link 2 content and hides the rest) and then prints with window.print().

See Going to Print and Working with Alternate Stylesheets.

As I said, this could be more complex than what you're looking for, so an easy solution would be what you suggested earlier about opening a new window and printing.
Reply
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,248 network members.