If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the largest domain name community on the internet and continues to grow every day. There are over 105,000 domainers on DNForum doing everything from buying domains, selling domains, learning about domains and discussing domains. Take a minute and Register.
Register Today on DNForum IT'S FREE!I want to print out a webpage via the window.print() command.
According to my documentation, window.print() acts exactly as if the user had clicked the "print" button. However, when the command is invoked, the print dialog box ALWAYS pops up.
When I click the little printer at the top of the IE browser, the page just goes to the printer. When I click "File->Print" I always get the print dialog box.
Is there a way to print the webpage without having the print dialog box come up and forcing the user to actually click "OK" or "Cancel" (i.e. simulate the little print icon at the top of the IE browser)?
-Bob
. . .
Unfortunately the answer is no.
Javascript doesn't provide a method for "print immediately" -- this would have to be pretty browser specific, as many browsers don't even have a "print immediately" functionality.
We looked into making an activex control to do it, but the client didn't want to pay for that. Post here if you find a free one!
I figured out that I cannot do that after I posted my message. UGH. It makes sense though. How would you like to go to a website and haveyour printer start printing a complete unedited version of "War and Peace"?
My solution was to put everything I want to print on the browser screen and then issue the window.print() command after that. That eliminated the client from having to click the "Print" button in the print dialog box 800 times and only forces them to do it only once.
I also had the problem of making the output come out on nice pages and not having it all crammed together (i.e. the second page starts half way down the first page). Since HTML does not have a page-break tag, I was able to solve that problem by using a style. (style="page-break-after: always")
Coding - always an interesting job.
-Bob
. . .
Bob, now I understand why you have so much patience!
WebCat
/\_/\
(0 0) php! Perl! Apache! javascript! Linux! CSS! .......AHRRGGGG!
>^<
\__/
MetallicaForum.com - DomainElf.com - Exclaims.net
DomainExpires.com - TouringSound.com - SongNet.us
SongClick.com - DedicatedTraffic.com - AmericanMovie.us
How about this?
http://www.faqts.com/knowledge_base/view.phtml/aid/9169
Profoundly influenced by #Bauhaus, Nameslave unrepentantly embraces Minimalism in his #multimedia portfolio. His early works include an experimental adaptation of Chekhov’s Cherry Orchard using the #Minimalist method inspired at least partly by the music of Robert Fripp. His totally irrelevant M.Ed. dissertation examines Organizational Culture and Change Management.
WOW! Thanks nameslave.
FYI- it's an IE-only solution, but a solution nonetheless. Hopefully bad people don't get a hold of this, or we could be killing an exceptional number of trees.
Bookmarks