Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become an Expert!

Join 244,295 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 922 people online right now. Registration is fast and FREE... Join Now!




Printing In HTML

 
Reply to this topicStart new topic

Printing In HTML, HTML

kaushiks
4 Jul, 2006 - 02:23 AM
Post #1

New D.I.C Head
*

Joined: 7 Mar, 2006
Posts: 40


My Contributions
hi,

I am new to html, so there are some basic things that i dont know.

Is there any code in html to print a page?
If we want to print a specific area and not the whole page how is it written in html?

Please guide me through this, coz i am a little confused in this printing functionality


regards,
kaushik

User is offlineProfile CardPM
+Quote Post


max302
RE: Printing In HTML
4 Jul, 2006 - 04:25 AM
Post #2

Proud supporter of the lulz
Group Icon

Joined: 5 Mar, 2006
Posts: 1,281



Thanked: 1 times
Dream Kudos: 200
My Contributions
I assume that you mean print like in print with a printer. You're going out of HTML here, as HTML's only job is to render. To print a page, you would have to use Javascipt window.print(). To trigger this you would of couse have to put an a tag around it like so <a href="window.print()"> or an onclick or something of the kind. Since javascript is kind of hierarchical, i guess that you could also put window.form.print() is you want to print a form window.iframe.print() to print an iframe. Go ahead and learn a little javascript at http://www.w3schools.com/
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Printing In HTML
4 Jul, 2006 - 04:26 AM
Post #3

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,977



Thanked: 116 times
Dream Kudos: 25
My Contributions
There is no way to use HTML to send data to a printer, I'm afraid...you'll need a scripting language to do that.

[edit]Whoops...me and max were replying at the same time...max was quicker! smile.gif[/edit]

This post has been edited by Amadeus: 4 Jul, 2006 - 04:28 AM
User is online!Profile CardPM
+Quote Post

max302
RE: Printing In HTML
4 Jul, 2006 - 04:54 AM
Post #4

Proud supporter of the lulz
Group Icon

Joined: 5 Mar, 2006
Posts: 1,281



Thanked: 1 times
Dream Kudos: 200
My Contributions
QUOTE(Amadeus @ 4 Jul, 2006 - 04:18 AM) *

There is no way to use HTML to send data to a printer, I'm afraid...you'll need a scripting language to do that.

[edit]Whoops...me and max were replying at the same time...max was quicker! smile.gif[/edit]


I post faster than my shadow!
User is offlineProfile CardPM
+Quote Post

kaushiks
RE: Printing In HTML
4 Jul, 2006 - 10:13 PM
Post #5

New D.I.C Head
*

Joined: 7 Mar, 2006
Posts: 40


My Contributions
QUOTE(max302 @ 4 Jul, 2006 - 04:46 AM) *

QUOTE(Amadeus @ 4 Jul, 2006 - 04:18 AM) *

There is no way to use HTML to send data to a printer, I'm afraid...you'll need a scripting language to do that.

[edit]Whoops...me and max were replying at the same time...max was quicker! smile.gif[/edit]


I post faster than my shadow!


guys what u r saying is alright, but how can we determine the area of page to print. For example top half of my web page has got banner on it, so i dont need to print that. say use window.form.print will print the form area.
What if i have got some tables to be printed ??

please enlighten me


regards,
kaushik
User is offlineProfile CardPM
+Quote Post

Arbitrator
RE: Printing In HTML
5 Jul, 2006 - 02:48 AM
Post #6

D.I.C Regular
Group Icon

Joined: 26 Jan, 2005
Posts: 497



Thanked: 9 times
My Contributions
CODE
<style type="text/css">
  @import "print.css" print;
  @media print {
    #banner {
      display: none;
      }
    }
</style>

User is offlineProfile CardPM
+Quote Post

max302
RE: Printing In HTML
5 Jul, 2006 - 10:54 AM
Post #7

Proud supporter of the lulz
Group Icon

Joined: 5 Mar, 2006
Posts: 1,281



Thanked: 1 times
Dream Kudos: 200
My Contributions
QUOTE(Arbitrator @ 5 Jul, 2006 - 02:40 AM) *

CODE
<style type="text/css">
  @import "print.css" print;
  @media print {
    #banner {
      display: none;
      }
    }
</style>



CSS does that? Wow... Another reason why CSS owns all.

But if you want to stay with javascript, learn how a page is heirarchically divided in JS and from there, you should find a solution to your problem, young padawan.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 04:22PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month