Jump to content

Printing Problem


raviprakashg
 Share

Recommended Posts

I would use css for this.here's a quick example

<head><style>@media Print{p{ display:none }}</style></head><body><p>i will not print</p><div>i will print</div></body>

Link to comment
Share on other sites

@media Print refers to anything that has to do with printing. Then if you go down into the stylesheet you see what's he's done. He does normal CSS by defining P, the paragraph tag (<p>), and then sets it's properties to display:none, making it not show up. So this means that anything with a <p> tag around it will not print, as opposed to the text with the <div> tag around it, which will print. You can make this easier by defining classes.

<style>@media Print {  .noprint { display:none; }}</style><p class=noprint>I won't print</p><p>I will print</p><div class=noprint>I also won't print</div><div>But I will</div>

Anything that you define as the noprint class won't print.

Link to comment
Share on other sites

Dear Friends,I Got a Problem  in Printing an Web Page, I have to Print Only  a part of an web page (ie Only data in <Div>) its possible in JS? if So Please Help Me.thks hav gud dayurs raviprakash

30 second reply. My team have used these typically when printing pages with many absolute divs. 1. grab the innerHTML (there's an example to show it going to a button). Example use <div id=p1> to get by id , or get the object the users click (also example) which element clicked Put in a <div> in a new window . user can print that 2. Insert a blank <div > at document start (top:0). Move <div> to print using position:absolute to start. Tell user to print first page.BUT containment issues. Are these for your sites or off the web. ?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...