C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Printing a page through javascript


Posted Date: 01 Aug 2008      Total Responses: 2

Posted By: veena patange       Member Level: Silver     Points: 1



Hi
Can any body help me..

I want to print a page which contains an image /watermark image which should also be printed on the page..
here my page is printed but
1. the watermark image is not Printed
2. the printed page contains the page number i.e. Page 1 of 1 in header and the site url(http://www.dotnetspider.com/forum/PostForum.aspx) in the footer. I want to avoid the header and footer data..

here is my javascript to print the page content::
strid==is the div to be printed i.e content of page...
tbPrint==is the table id

function CallPrint(strid)
{
var prtContent = document.getElementById(strid);
var theImage = new Image(100,449);
var thetab=document.getElementById('tbPrint');
theImage.src = "../images/certificatebgimage.jpg";
tbPrint.style.backgroundImage = "url(" + theImage.src + ")";
tbPrint.style.backgroundRepeat ="no-repeat";
tbPrint.style.backgroundPosition="center";
tbPrint.style.backgroundAttachment ="fixed";
var WinPrint = window.open('','','letf=0,top=0,width=670,height=600,toolbar=0, scrollbars=1,sta­tus=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
}
Help me for this it is bit urgent...

thanks & regards
veena





Responses

Author: Koteswara Rao    01 Aug 2008Member Level: GoldRating:     Points: 2

function CallPrint(strid)
{
popup = window.open('','popup','toolbar=no,menubar=no,width=200,height=150');
popup.document.open();
popup.document.write("<html><head></head><body onload='print()'>");
popup.document.write(strid);
popup.document.write("</body></html>");
popup.document.close();
}



Author: veena patange    01 Aug 2008Member Level: SilverRating:     Points: 5

Hi Koteswara Rao ,
thanks for the reply but the javascript u sent is not actual i want the javascript i gave i perfectlly working.... but the image or u can say backgroung image of the page is not printing...
and the page number in header and url in the footer should not display
I have gone through some articles but didn't find the solution

Can any body help me for this
it is bit urgent

regards
veena



Post Reply
You must Sign In to post a response.
Next : window.close() in javascript
Previous : window.close() in javascript
Return to Discussion Forum
Post New Message
Category: JavaScript

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use