Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,628 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,029 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
post 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

Go to the top of the page

max302
post 4 Jul, 2006 - 04:25 AM
Post #2


Proud supporter of the lulz

Group Icon
Joined: 5 Mar, 2006
Posts: 1,281



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

Go to the top of the page

Amadeus
post 4 Jul, 2006 - 04:26 AM
Post #3


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,176



Thanked 33 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 offlineProfile CardPM

Go to the top of the page

max302
post 4 Jul, 2006 - 04:54 AM
Post #4


Proud supporter of the lulz

Group Icon
Joined: 5 Mar, 2006
Posts: 1,281



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

Go to the top of the page

kaushiks
post 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

Go to the top of the page

Arbitrator
post 5 Jul, 2006 - 02:48 AM
Post #6


D.I.C Regular

Group Icon
Joined: 26 Jan, 2005
Posts: 492



Thanked 1 times
My Contributions


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

Go to the top of the page

max302
post 5 Jul, 2006 - 10:54 AM
Post #7


Proud supporter of the lulz

Group Icon
Joined: 5 Mar, 2006
Posts: 1,281



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

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 03:40AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month