Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page Setup Settings 2

Status
Not open for further replies.

VBRookie

Programmer
May 29, 2001
331
US
Hi,

I'm creating a web form for the Army and it must duplicate the actual form as much as possible and it must all fit on one page. Is there a way to programmatically set the default margin settings (.75) to 0 and remove the header and footer text using Javascript?

- VB Rookie
 
headers & footers : sounds like it's a template - it's better to remove them from the template so that they're nevr build than building them THEN removing them
margin size : do it in css (style sheets), it's one .css file to include in all your pages, and only once if you use templates ------
please review FAQ183-874 - this will help you to get the best out of tt
[ "you" is not someone in particular - don't take it too personnal ]
 
The Header and Footer/Margin settings are those contained in the browser. For IE the default is .75 and it automatically prints a page header which is the title of the web page and a page footer which is the web address of the page.

I can remove those settings by going into File -- Page Setup on the browser and deleting the Header and Footer and setting the margin to zero.

But I was wondering if there is a way to do it programmatically via Javascript or some other method.

Thanks,
- VB Rookie
 
You're probably aware of this, but here's one way to do it...
Code:
<html>
<head>
<script type=&quot;text/vbscript&quot;>
Dim WSHShell
Set WSHShell = CreateObject(&quot;WScript.Shell&quot;)
WSHShell.RegWrite &quot;HKCU\Software\Microsoft\Internet Explorer\PageSetup\header&quot;, &quot;&quot;
WSHShell.RegWrite &quot;HKCU\Software\Microsoft\Internet Explorer\PageSetup\footer&quot;, &quot;&quot;

WSHShell.RegWrite &quot;HKCU\Software\Microsoft\Internet Explorer\PageSetup\margin_top&quot;, &quot;0&quot;
WSHShell.RegWrite &quot;HKCU\Software\Microsoft\Internet Explorer\PageSetup\margin_right&quot;, &quot;0&quot;
WSHShell.RegWrite &quot;HKCU\Software\Microsoft\Internet Explorer\PageSetup\margin_bottom&quot;, &quot;0&quot;
WSHShell.RegWrite &quot;HKCU\Software\Microsoft\Internet Explorer\PageSetup\margin_left&quot;, &quot;0&quot;
</script>
</head>
<body>
Printer settings changed
</body>
</html>
 
ok ! you can also use the @media tag from css
it's a tag that defines what the page should look like when printed
 
Thanks aPerfectCircle and iza,

I didn't know about this functionality. Your help and expertise is very much appreciated.

Thanks again,
- VB Rookie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top