tacallah
05-19-2003, 12:02 PM
I have a report stored in a string, and I want to send it to the printer. Has anyone done this? Below is some code that works if I open it as C:\Temp\Test.htm in Internet Explorer, but I receive the error "Automation server can't create object" when I save the same file on the web server and open it in Internet Explorer. If there is better way to do this, please let me know. I know this is the JavaScript forum, but I am using ASP. Could I possible use Response.BinaryWrite instead?
Thanks in advance for your help!
Tim
<INPUT TYPE="Button" VALUE="Print Text" onClick=PrintIt()>
<SCRIPT LANGUAGE="JavaScript">
function PrintIt()
{
var ofs, oPrinter;
ofs = new ActiveXObject("Scripting.FileSystemObject");
oPrinter = ofs.CreateTextFile("LPT1:", true);
oPrinter.Write("Test");
oPrinter.Close();
alert("Done");
}
</SCRIPT>
Thanks in advance for your help!
Tim
<INPUT TYPE="Button" VALUE="Print Text" onClick=PrintIt()>
<SCRIPT LANGUAGE="JavaScript">
function PrintIt()
{
var ofs, oPrinter;
ofs = new ActiveXObject("Scripting.FileSystemObject");
oPrinter = ofs.CreateTextFile("LPT1:", true);
oPrinter.Write("Test");
oPrinter.Close();
alert("Done");
}
</SCRIPT>