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

printer code question- please help!!

Status
Not open for further replies.

tigger23

Programmer
Sep 19, 2001
10
US
Hi...
Can anyone tell me how to make a printer-friendly page using asp and html... how does the browser know what size paper the user will use... it needs to be printable in both the US (letter paper) and standard A4...

Thanks in advance!
 
Here's an example that we use in our app.

<%
dim lineno
lineno = 0

WHILE NOT Rs.EOF

IF lineno >= 60
lineno = 0
%>
<!--
INSERT A TABLE COLUMN WITH A PRINTER PAGE BREAK
-->
<tr style=&quot;page-break-after:always;&quot;>
<td width=&quot;100%&quot;></td>
</tr>
<%
END IF
%>
<tr>
<td width=&quot;100%&quot;><%=RsInfo%></td>
</tr>
<%
lineno = lineno + 1
Rs.MoveNext
WEND
%>

This would force a printer page break every 60 records. You can play around with the numbers to get your desired result. The key is in the style=&quot;page-break-after:always;&quot; attribute which we place inside the <tr> tag but I've seen people create classes and reference those inside <p> tags, etc... You can go to the HTML-CSS forum and search for &quot;page break&quot; to get more details.

Note: As far as I know, the style attribute only works on IE 4 or greater and you may have trouble with Netscape.

Search for &quot;printer page&quot; on and you'll see some other neat tools for page layouts and printer pages in IE.

TW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top