I am using the following code to print a page within my application...
<html><body onload=""window.print();"">"
sHtmlBody = sHtmlBody & "<body>"
The window.print()
is working fine.
I know once the print comes up I can manually go into the settings and remove headers and footer.
On IE I know that I have to go to print preview and then remove the print headers.
However, is there some line of code which does this automatically so the users of the application don't have to do this?
EDIT:
sHtmlBody = "<style type='text/css'>"
sHtmlBody = sHtmlBody & " @media print{"
sHtmlBody = sHtmlBody & " body{ background-color:#FFFFFF; background-image:none; color:#000000 }"
sHtmlBody = sHtmlBody & " #ad{ display:none;}"
sHtmlBody = sHtmlBody & " #leftbar{ display:none;}"
sHtmlBody = sHtmlBody & " #contentarea{ width:100%;}"
sHtmlBody = sHtmlBody & " }"
sHtmlBody = sHtmlBody & " </style>"
sHtmlBody = sHtmlBody & "<html><body onload=""window.print();"">"
sHtmlBody = sHtmlBody & "<body>"