I want user to be able to click print button and it will print document in web page.
I try to use window.print(); but it prints everything including transparent font color. I want to print document without printing transparent object. How can I do this??
Loading
Suthish NairPosted Oct 20, 2010, 2:06 AM
Suthish NairPosted Oct 25, 2010, 3:57 AM
yoyoy garagePosted Oct 20, 2010, 10:16 PM
and what can I do if I do not know what to print because user will set color on their own?
Can I check if this control has white color then do not copy it into new page?
Suthish NairPosted Oct 20, 2010, 7:13 AM
refer link
more
yoyoy garagePosted Oct 20, 2010, 5:59 AM
<TABLE style="TABLE-LAYOUT: fixed; Z-INDEX: 102; LEFT: 0px; COLOR: #e0e0e0; POSITION: absolute; TOP: 0px; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #ffffff" borderColor=#e0e0e0 cellSpacing=0 cellPadding=0 border=2>
<TBODY>
<TR bgColor=#d3d3d3>
<TD style="WIDTH: 50px; HEIGHT: 20px" align=middle><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 10px; FONT-STYLE: normal" face="Microsoft Sans Serif" color=#000000>FONT>TD>
<TD style="WIDTH: 50px; HEIGHT: 20px" align=middle><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 10px; FONT-STYLE: normal" face="Microsoft Sans Serif" color=#000000>FONT>TD>
<TD style="WIDTH: 50px; HEIGHT: 20px" align=middle><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 10px; FONT-STYLE: normal" face="Microsoft Sans Serif" color=#000000>FONT>TD>
<TD style="WIDTH: 50px; HEIGHT: 20px" align=middle><FONT face=Tahoma color=#000000 size=1>FONT>TD>
<TD style="WIDTH: 50px; HEIGHT: 20px" align=middle><FONT face=Tahoma color=#000000 size=1>FONT>TD>
<TD style="WIDTH: 50px; HEIGHT: 20px" align=middle><FONT face=Tahoma color=#000000 size=1>FONT>TD>TR>
<TR>
<TD style="WIDTH: 50px; HEIGHT: 20px; TEXT-ALIGN: left"><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 10px; FONT-STYLE: normal" face="Microsoft Sans Serif" color=#000000><SPAN id=Table1_LlblTable1_R0_C0 style="DISPLAY: inline-block; WIDTH: 50px; HEIGHT: 20px; TEXT-ALIGN: left">hhdhjdhjsdSPAN>FONT>TD>
<TD style="WIDTH: 50px; HEIGHT: 20px; TEXT-ALIGN: left"><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 10px; FONT-STYLE: normal" face="Microsoft Sans Serif" color=#ffffff><SPAN id=Table1_LlblTable1_R0_C1 style="DISPLAY: inline-block; WIDTH: 50px; HEIGHT: 20px; TEXT-ALIGN: left">ettetetSPAN>FONT>TD>
<TD style="WIDTH: 50px; HEIGHT: 20px; TEXT-ALIGN: left"><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 10px; FONT-STYLE: normal" face="Microsoft Sans Serif" color=#000000><SPAN id=Table1_LlblTable1_R0_C2 style="DISPLAY: inline-block; WIDTH: 50px; HEIGHT: 20px; TEXT-ALIGN: left">ijfidfjifjSPAN>FONT>TD>
<TD style="HEIGHT: 20px">TD>
<TD style="HEIGHT: 20px">TD>
<TD style="HEIGHT: 20px">TD>TR>
<TR>
<TD style="WIDTH: 50px; HEIGHT: 20px; TEXT-ALIGN: left"><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 10px; FONT-STYLE: normal" face="Microsoft Sans Serif" color=#000000>FONT><INPUT id=Table1_txtTable1_R1_C0 style="FONT-WEIGHT: normal; FONT-SIZE: 8pt; WIDTH: 50px; COLOR: #000000; FONT-FAMILY: Microsoft Sans Serif; HEIGHT: 20px; TEXT-ALIGN: left" name=Table1$txtTable1_R1_C0>TD>
<TD style="WIDTH: 50px; HEIGHT: 20px; TEXT-ALIGN: left"><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 10px; FONT-STYLE: normal" face="Microsoft Sans Serif" color=#ffffff>FONT><INPUT id=Table1_txtTable1_R1_C1 style="FONT-WEIGHT: normal; FONT-SIZE: 8pt; WIDTH: 50px; COLOR: #ffffff; FONT-FAMILY: Microsoft Sans Serif; HEIGHT: 20px; TEXT-ALIGN: left" name=Table1$txtTable1_R1_C1>TD>
<TD style="WIDTH: 50px; HEIGHT: 20px; TEXT-ALIGN: left"><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 10px; FONT-STYLE: normal" face="Microsoft Sans Serif" color=#000000>FONT><INPUT id=Table1_txtTable1_R1_C2 style="FONT-WEIGHT: normal; FONT-SIZE: 8pt; WIDTH: 50px; COLOR: #000000; FONT-FAMILY: Microsoft Sans Serif; HEIGHT: 20px; TEXT-ALIGN: left" name=Table1$txtTable1_R1_C2>TD>
<TD style="HEIGHT: 20px"><INPUT id=Table1_cmdTable1_R1 style="WIDTH: 48px; HEIGHT: 20px" disabled type=submit value=ADD name=Table1$cmdTable1_R1>TD>
<TD style="HEIGHT: 20px"><INPUT id=Table1_cmdETable1_R1 style="WIDTH: 48px; HEIGHT: 20px" disabled type=submit value=EDIT name=Table1$cmdETable1_R1>TD>
<TD style="HEIGHT: 20px"><INPUT id=Table1_cmdRTable1_R1 style="WIDTH: 48px; HEIGHT: 20px" disabled type=submit value=DEL name=Table1$cmdRTable1_R1>TD>TR>TBODY>TABLE>DIV>SPAN><INPUT id=xmSaveData style="LEFT: 0px; WIDTH: 0px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; POSITION: absolute; TOP: 0px; HEIGHT: 0px; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none" type=submit name=xmSaveData> <INPUT id=xmRefresh style="LEFT: 0px; WIDTH: 0px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; POSITION: absolute; TOP: 0px; HEIGHT: 0px; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none" type=submit name=xmRefresh> <INPUT id=xmSaveAsData style="LEFT: 0px; WIDTH: 0px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; POSITION: absolute; TOP: 0px; HEIGHT: 0px; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none" type=submit name=xmSaveAsData> <INPUT id=xmSearchData style="LEFT: 0px; WIDTH: 0px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; POSITION: absolute; TOP: 0px; HEIGHT: 0px; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none" type=submit name=xmSearchData> FORM>
Suthish NairPosted Oct 20, 2010, 5:48 AM
yoyoy garagePosted Oct 20, 2010, 4:39 AM
And can I do it if I used that link to another form?
Suthish NairPosted Oct 20, 2010, 3:54 AM
wrap all your contents (thats needed to print) in divPrintMe, and use the javascript i posted.
yoyoy garagePosted Oct 20, 2010, 3:45 AM
this is the code I used
function printpr()
{
var prtContent = parent.document.getElementById("ifrmDetail");
var WinPrint = window.open('', '', 'left=0,top=0,width=0,height=0,toolbar=0,scrollbars=1,status=0');
WinPrint.document.open();
WinPrint.document.write('
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
}
Suthish NairPosted Oct 20, 2010, 3:41 AM
Are you binding the records before printing or post your code here as attachment.
yoyoy garagePosted Oct 20, 2010, 3:28 AM
yoyoy garagePosted Oct 19, 2010, 11:42 PM
I want to print just what I can see.
try print this page. you will see "test" below this line.
test
Suthish NairPosted Oct 19, 2010, 4:39 PM
Better you attach your sample output file here, so we can have a look...
yoyoy garagePosted Oct 19, 2010, 3:35 AM
Posted Oct 19, 2010, 2:25 AM
http://www.alistapart.com/articles/goingtoprint/
Hope you will get some idea.