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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Print Macro from ASP -Help or better method

Status
Not open for further replies.

danieljoo

MIS
Oct 9, 2002
43
US
I created a db for a seminar which allows the user to lookup companies, then add or update attendees, then print a nametag for that attendee. In the past this was all done in access, but this year we are going with asp becuase the interface is easier for our users and easier for me to program. The db and asp is all set except for one thing -- printing the nametags. We used to do this using an access form, which I believe we still need to do becuase we need to have the control over print formatting. Can someone help on how to run a print macro from asp and send three fields with it - attendee, company, address. thanks.
 
Since ASP runs serverside, if you were to print from ASP you would be printing from the server rather than the client you are viewing the page through. One option here is to use CSS to define a specific look and feel for your print outs. CSS (in IE) will actually allow you to define a seperate look and feel for the screen and the printer, for example, take a look at this piece of script:
Code:
<html>
<head>
<style media=&quot;screen&quot;>
	.nametag{
		border:2px dashed #7777dd;
		width:4in;
		margin:5px;
		padding:10px;
	}
	.hmni{
		font-size:26px;
		font-family:Arial;
		width:100%;
		margin:5px;
		color:#3333AA;
		font-style:italic;
	}
	.name{
		font-style:italic;
		font-size:22px;
		font-family:verdana;
		margin-right:.5in;
		float:right;
		border-bottom:1px solid #444499;
		width:2in;
		text-align:center;
	}
	.company{
		font-size:9px;
		font-family:verdana;
	}
</style>
<style media=&quot;print&quot;>
	.nametag{
		width:4in;
		margin:5px;
		padding:10px;
	}
	.hmni{
		visibility:hidden;
		font-size:26px;
		font-family:Arial;
		width:100%;
		margin:5px;
		color:#3333AA;
		font-style:italic;
	}
	.name{
		font-style:italic;
		font-size:22px;
		font-family:verdana;
		margin-right:.5in;
		float:right;
		width:2in;
		text-align:center;
	}
	.company{
		font-size:9px;
		font-family:verdana;
	}
</style>
</head>
<body>
<div class=&quot;nametag&quot;>
<span class=&quot;hmni&quot;>Hello My Name Is:</span>
<span class=&quot;name&quot;>Joe Smith</span><br><br>
<span class=&quot;company&quot;>My Company Inc<br>101 My Street<br>MyCity, MS 11111</span>
</div>
<div class=&quot;nametag&quot;>
<span class=&quot;hmni&quot;>Hello My Name Is:</span>
<span class=&quot;name&quot;>John Smith</span><br><br>
<span class=&quot;company&quot;>Another Company Inc<br>102 My Street<br>MyCity, MS 11111</span>
</div>
<div class=&quot;nametag&quot;>
<span class=&quot;hmni&quot;>Hello My Name Is:</span>
<span class=&quot;name&quot;>Joan Smith</span><br><br>
<span class=&quot;company&quot;>ThisOther Company Inc<br>103 My Street<br>MyCity, MS 11111</span>
</div>
</body>
</html>

Now I threw this together quite quickly, so the measurements are probably quite a bit off, but in this case you can see I was designing a name tag that I would be printing on pre-existing tags. If you pull up this html in a browser window it has a generic border, a hello my name is, and an underline for the name. Obviously I wouldn't want these if I was printing, so pull up print preview from the file menu, and voila, slightly differant appearance. I could have gone much farther with the differances, even giving it a completely differant layout, but I believed this would serve as a decent example.
Hope this helps,
-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...) :p
 
This just might work. Is it possbile to run this without opening the page or opening it and closing it quickly?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top