I haven't tried it with the command prompt, I reckon you could achieve the same 
result, I have only used the Windows Scripting Object to print before, I just searched 
for a sample of it on the web and converted it to CF

Here is a sample that might get you going?

I am assumes you are familiar with creating objects in CF?

Set objFS = CreateObject("Scripting.FileSystemObject")

Would for example be 
<cfscript>
objFS = createObject("com", "Scripting.FileSystemObject");
</cfscript>

Having said that, http://www.cfcomet.com might have something already written - I 
myself always like to play around and create my own script so I understand what is 
happening ;-))

Set objFS = CreateObject("Scripting.FileSystemObject")
Set objWSHNet = CreateObject("WScript.Network")

The AddPrinterConnection method maps the remote printer specified by strPrinterPath to 
the local resource name. In this example, we use LPT1. We populate this connection 
with the values previously retrieved from our form collection.

' Connect to Network Printer from Windows Script Host
'
objWSHNet.AddPrinterConnection "LPT1", strPrinterPath, False, strUsername, strPassword

With the connection established, we use FileSystemObject to stream the message to the 
printer.

   '
   ' Open Print device as a file using the File System Object
   '
   Set objPrinter = objFS.CreateTextFile("LPT1:", True)
   '
   ' Send text to print device using the File System Object
   '
   objPrinter.Write(strMessage)

Error trapping is always a good idea. The following section will trap for errors while 
closing the connection to our printer object. For production code, supply this type of 
error handling throughout your page.

   '
   ' Close the print device object and trap for errors
   '
   On Error Resume Next
   objPrinter.Close
   '
   ' If an error has occurred while closing the printer connection,
   ' output what went wrong.
   '
   If Err Then
      Response.Write ("Error # " & CStr(Err.Number) & " " & Err.Description)
      Err.Clear
   Else


-----Original Message-----
From: Phil Evans [mailto:[EMAIL PROTECTED]
Sent: Thursday, 11 December 2003 8:10 AM
To: CFAussie Mailing List
Subject: [cfaussie] RE: Print from CF


Thanks Taco.

Server side.

By windows scripting, do you mean the command prompt print command?

I've never had to use that. The help states it's for text files, but if it
can send PDF files to a networked printer that would be great.

Any thoughts on syntax?

Thanks,
Phil.

----- Original Message ----- 
From: "Taco Fleur" <[EMAIL PROTECTED]>
To: "CFAussie Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, December 11, 2003 9:04 AM
Subject: [cfaussie] RE: Print from CF


> Where do you want it to print, on the server side or the client side?
>
> If on the server side I reckon you could do it with Windows Scripting, if
on the client-side ??? Maybe an ActiveX control?
>
> -----Original Message-----
> From: Phil Evans [mailto:[EMAIL PROTECTED]
> Sent: Thursday, 11 December 2003 8:00 AM
> To: CFAussie Mailing List
> Subject: [cfaussie] Print from CF
>
>
> Hi All,
>
> Is there any way to send a PDF to a printer from CF? I have a system that
> produces the PDF, and once created I would like it to print automatically
> without further user intervention.
>
> Intranet environment, IE6, CFMX.
>
> Thanks,
> Phil.
>
>
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
[EMAIL PROTECTED]
>
> MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
> http://www.mxdu.com/ + 24-25 February, 2004
>
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
[EMAIL PROTECTED]
>
> MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
> http://www.mxdu.com/ + 24-25 February, 2004
>


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to