View Full Version : Writing to file on client machine
Is this possible? What I really want to do is write a file to the printer. It can't be a screen print, as I want to send specific printer codes. The codes I send are dependent on input from the user via their browser, so Ideally I would like to open a file, assigned to "lpt1", via vbscript or jscript, and write to that file.
Is this Possible?
I don't know where else to ask this question, so hopefully this is not too off-topic for this Off-topic group.
There are two solutions (that I know of) that will allow you to do this automatically, both only work in IE and both will clash with the security settings.
First, you could get the user to download an ActiveX control - it'd be pretty straight forward to make one that can be sent values from Javascript and then be told to write the file and then print it. If you get the control "signed" there won't be many security issues.
Secondly, use client-side vbscript and the FileSystem Object to write the files, however, if someone agrees to let you do this they are stupid as with a couple of commands you could delete their hard drive...
Otherwise, how about using Javascript or a serverside language to write a new page (except set the MIME type as Text/plain not HTML) and then allow the user print the file themselves.
<font face='Courier New'><font color=maroon>»» Dan (dan@pupius.net)
»» www.pupius.net || [url="http://www.dhtmlcentral.com/resources/redirect.asp?linkid=23"]www.endoflow.com[/url:rhlqfumwy1]</font id=maroon></font id='Courier New'>
Ok, here's something I've just been playing with. It'll only work locally as it seems the IE security settings don't allow you to create the Scripting Objects from a remote machine.
http://www.endoflow.com/temp/print.htm
<font face='Courier New'><font color=maroon>»» Dan (dan@pupius.net)
»» www.pupius.net || [url="http://www.dhtmlcentral.com/resources/redirect.asp?linkid=23"]www.endoflow.com[/url:ybe7qsss00]</font id=maroon></font id='Courier New'>
vBulletin® v3.6.7, Copyright ©2000-2008, Jelsoft Enterprises Ltd.