PDA

View Full Version : window.print ???



Rino5555
06-18-2008, 01:02 PM
Hi to all...

Using the window.print() is there a way i can tell it from point a to b to be printed on a page?

Thanking you in advance

Rino

Nile
06-18-2008, 01:08 PM
There is something in CSS that you can do, check this out:
http://www.w3.org/TR/REC-CSS2/media.html

Rino5555
06-18-2008, 04:08 PM
i'm lost sorry...
I have the following that i have in my page...
that if i send this to a printer it prints out labels with info on it...
but when i put it in my page i have <tabel> tr td etc... tags take gives me an error when sending to a printer...
{I,B,0,1,0,0|}
{I,C,0,0,0,80|}
{I,G,1,150,150|}
{F,1,A,R,G,669,256,"FMT"|
T,1,250,V,217,25,0,50,32,18,B,L,0,3|
T,2,250,V,587,149,0,50,10,9,B,L,0,3|
T,3,250,V,110,100,0,50,18,13,B,L,0,3|
T,4,250,V,587,216,0,50,12,10,B,L,0,3|
B,5,6,V,441,46,3,0,51,8,L,3|
R,50,3,9|
T,6,250,V,587,125,0,50,10,9,B,L,0,3|
T,7,250,V,587,184,0,50,12,10,B,L,0,3|
T,8,250,V,554,46,0,50,7,7,B,L,0,3|
T,9,250,V,601,46,0,50,7,7,B,L,0,3|
T,10,250,V,597,19,0,50,7,7,B,L,0,3|
T,11,250,V,556,19,0,50,7,7,B,L,0,3|
T,12,250,V,398,11,0,50,10,10,B,L,0,3|
L,S,239,13,239,102,4,""|
L,S,5,13,5,102,4,""|
L,S,9,13,238,13,5,""|
L,S,9,98,238,98,5,""|
L,S,3,178,642,178,3,""|
}
{G,1,A,T,G,1,1,0,"BMAP"|
}
{
B,1,N,00002|
E,0,0,1,1,3,2|
4,"LINE1"|
7,"LINE2"|
2,"LINE3"|
6,"LINE4"|
1,"PRICE"|
5,"051744"|
8,"5487"|
9,"CAT:"|
10,"VS/"|
11,"1605998"|
12,"051744"|
}

Master_script_maker
06-18-2008, 04:26 PM
can you show us your code?

jscheuer1
06-18-2008, 04:54 PM
A simple example:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" media="screen">
/* whatever your usual style (if any) is can go here below this comment */
</style>
<style type="text/css" media="print">
div {
display:none;
}
.printable {
display:block;
}
</style>
</head>
<body>
<div>
Stuff Here at the top we don't want printed
</div>
<div class="printable">
We want this printed
</div>
<div class="printable">
this too.
</div>
<div>
Stuff here at the bottom we don't want printed.
</div>
</body>
</html>

boogyman
06-18-2008, 05:31 PM
A simple example:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" media="screen">
/* whatever your usual style (if any) is can go here below this comment */
</style>
<style type="text/css" media="print">
div {
display:none;
}
.printable {
display:block;
}
</style>
</head>
<body>
<div>
Stuff Here at the top we don't want printed
</div>
<div class="printable">
We want this printed
</div>
<div class="printable">
this too.
</div>
<div>
Stuff here at the bottom we don't want printed.
</div>
</body>
</html>

from his post it sounds like he is using tables, which generally are not very css printer style friendly unless he wants to take out a whole row... which usually isn't the case.... a column is more likely to be omitted, which is obviously not the easiest to do and keep the layout printer friendly.

if that is the case, I would suggest that you (Rino) look into re-writing the page into a standards-friendly environment and you can use CSS styles like above to print / hide / rearrange however you want them

Rino5555
06-18-2008, 05:50 PM
here is my code...
even if i just put what i sent before with window.print i get an error as while..

just want to let you know.. when i send to the printer from textpad it words fine if i paste it in word i get the same error...

can it be that i have to make the font as text???

<table BORDER=0>
<tr>
<td><script>window.print();</script>
<%
Set rs = connHartStores.Execute("sp_GetSKUToPrint'" & Request.QueryString("PromoSKU") &"'")

If not rs.eof Then
Do until rs.eof

Response.Write "{I,B,0,1,0,0|}" & Chr(13)
Response.Write "{I,C,0,0,0,80|}"& Chr(13)
Response.Write "{I,G,1,150,150|}"& Chr(13)
Response.Write "{F,1,A,R,G,669,256," & Chr(34) & "FMT" & Chr(34) & "|"& Chr(13)
Response.Write "T,1,250,V,217,25,0,50,32,18,B,L,0,3|"& Chr(13)
Response.Write "T,2,250,V,587,149,0,50,10,9,B,L,0,3|"& Chr(13)
Response.Write "T,3,250,V,110,100,0,50,18,13,B,L,0,3|"& Chr(13)
Response.Write "T,4,250,V,587,216,0,50,12,10,B,L,0,3|"& Chr(13)
Response.Write "B,5,6,V,441,46,3,0,51,8,L,3|"& Chr(13)
Response.Write "R,50,3,9|"& Chr(13)
Response.Write "T,6,250,V,587,125,0,50,10,9,B,L,0,3|"& Chr(13)
Response.Write "T,7,250,V,587,184,0,50,12,10,B,L,0,3|"& Chr(13)
Response.Write "T,8,250,V,554,46,0,50,7,7,B,L,0,3|"& Chr(13)
Response.Write "T,9,250,V,601,46,0,50,7,7,B,L,0,3|"& Chr(13)
Response.Write "T,10,250,V,597,19,0,50,7,7,B,L,0,3|"& Chr(13)
Response.Write "T,11,250,V,556,19,0,50,7,7,B,L,0,3|"& Chr(13)
Response.Write "T,12,250,V,398,11,0,50,10,10,B,L,0,3|"& Chr(13)
Response.Write "L,S,239,13,239,102,4," & Chr(34) & "" & Chr(34) & "|"& Chr(13)
Response.Write "L,S,5,13,5,102,4," & Chr(34) & "" & Chr(34) & "|"& Chr(13)
Response.Write "L,S,9,13,238,13,5," & Chr(34) & "" & Chr(34) & "|"& Chr(13)
Response.Write "L,S,9,98,238,98,5," & Chr(34) & "" & Chr(34) & "|"& Chr(13)
Response.Write "L,S,3,178,642,178,3," & Chr(34) & "" & Chr(34) & "|"& Chr(13)
Response.Write "}"& Chr(13)
Response.Write "{G,1,A,T,G,1,1,0," & Chr(34) & "BMAP" & Chr(34) & "|"& Chr(13)
Response.Write "}"& Chr(13)
Response.Write "{"& Chr(13)
Response.Write "B,1,N,00002|"& Chr(13)
Response.Write "E,0,0,1,1,3,2|"& Chr(13)
Response.Write "4," & Chr(34) & "LINE2" & Chr(34) & "|"& Chr(13)
Response.Write "7," & Chr(34) & "LINE2" & Chr(34) & "|"& Chr(13)
Response.Write "2," & Chr(34) & "LINE3" & Chr(34) & "|"& Chr(13)
Response.Write "6," & Chr(34) & "LINE4" & Chr(34) & "|"& Chr(13)
Response.Write "1," & Chr(34) & "PRICE" & Chr(34) & "|"& Chr(13)
Response.Write "5," & Chr(34) & "051744" & Chr(34) & "|"& Chr(13)
Response.Write "8," & Chr(34) & "5487" & Chr(34) & "|"& Chr(13)
Response.Write "9," & Chr(34) & "CAT:" & Chr(34) & "|"& Chr(13)
Response.Write "10," & Chr(34) & "VS/" & Chr(34) & "|"& Chr(13)
Response.Write "11," & Chr(34) & "1605998" & Chr(34) & "|"& Chr(13)
Response.Write "12," & Chr(34) & "051744" & Chr(34) & "|"& Chr(13)
Response.Write "}"& Chr(13)

rs.MoveNext
Loop
End If

Set rs = Nothing
Set connHartStores = Nothing

%>

</td>
</tr>
</table>

Rino5555
06-18-2008, 06:21 PM
Thank you for your help...
i got it to work...
i added <font size="3" face="courier">
because i saw textpad uses courier as there font and it printed...

one other question...
to display data from the database is this the right way because it doesn't display...
Response.Write "4," & Chr(34) & rs("HeaderEng1") & Chr(34) & "|"& Chr(13)

Rino5555
06-18-2008, 06:23 PM
it works too...
because before i had
Response.Write "4," & Chr(34) & " & rs("HeaderEng1") & " & Chr(34) & "|"& Chr(13)
and i removed the " inbetween "
Response.Write "4," & Chr(34) & rs("HeaderEng1") & Chr(34) & "|"& Chr(13)