This would be very helpful to me in particular if ColdFusion recognized printers installed on the client machine, not attached to the server. Can this function do that? If not, are there any plans to build one that can?
That’s not possible. ColdFusion, and any server side software, can’t reach across to get client settings. It would be a major security hole if this were possible. The only way you could do it is by having something run on the client that reported this back to you, an ActiveX control or Java applet or something like that.
I have tried at my PC and I can not list the network printers which are registered with TCP/IP port. Is that something expected?
Ben, can you submit this to CFLIb? It would be one of the first CF8 only UDFs.
FYI, you can also get the list of OS printer names available to the OS user that the ColdFusion process is running as from the System Information page in the ColdFusion Administrator.
CFPRINT does look pretty cool. Just wish I could figure out a good scenario in which to use it. =
This is a nice, ummm…’gimicky’ tag, but I can’t think of a single situation in which I would ever use it. Why would I ever want anyone printing to my local server, or even to my local network? I suppose perhaps sales orders or maybe online employment applications (print to an HR printer), but why wouldn’t an email work just as well if not better.
If there were a way to access – w/ the users permission, of course – to the *client* printer, than THAT would be a big deal. Currently we have a major pain in the behind trying to force landscape printing to a local client printer (we’ve managed to…hack it, I guess, and it works, but its ugly….)
Neil, this is definitely one that many users won’t need, but those that do really want it. I’ve heard from quite a few customers who have been begging for this one for printing sales orders, packing slips, etc. — Ben
Here is a VERY COMMON application for a tag like this:
If you’re taking orders in the front office area (store), you can have the packing slip and receipt automatically print out to back room printers. Order "fillers" use them to fill the order and put them into the boxes along with product. This eliminates certain queuing steps in the order fulfillment process.
Another application for this tag would be in industries were documentation is king. Namely, insurance companies, mortgage and lending, banking etc…
Thanks for the tag! It’s a good thing.
Correct, Steve. Having just come off a project with a mortgage-lending company, their process works like this:
a) ALL network resources [servers, firewalls, printers, laptops, workstations, routers, etc] are tagged and bagged: IP-driven, internally and centrally controlled, what connects to what and who gets to see what
b) printers for "live" documents are very very tightly controlled, because there is million dollar liability in having closing documents printed on public printers … even worse in having 6 and 7-figure checks printed to public printers
c) therefore, Network Engineering establishes a limited number of known network printers which are the only ones allowed to print live mortgage documents and only a select few production application servers are allowed to connect to them; workstations and branch servers are NOT allowed to even see let alone connect to these printers
d) the net result is that printing can only be controlled by application code on the application servers, never by the client-side application code
This is a prime example of why a business would want to be able to write application code capable of enumerating server-side printer options. Excellent solution from CF! and the hack to get the PrinterInfo array is no worse than the one to get the available DSNs from the DataFactory. Thanks!
FYI, I have it on pretty good authority that a function like this will make it into a future update or version.
I have just run across the CFPRINT tag, and found it quite useful, but with some short comings in accessing the capabilities of the printer. For example: I’ve used the attributeStruct with "finishings=staple-top-left", but there is no stapling occuring. Also, there are a number of attributes that aren’t supported, that are somewhat "mission critical", such as selection of paper tray (na-letter is a fine paper size, but how do I specify which na-letter tray to use – one has plain copy paper, one has letterhead, one has invoice stock). Also, I can’t specify com-10 envelopes as a "paper size", nor can I specify booklet, or folding options, all of which the desired printer supports.
Please tell me that there will soon be a way to pass some of these other settings to the printer via CFPRINT.
getPrinterInfo() has returned info that resolves the problem with accessing the correct paper tray – including envelopes! It is, however, not forthcoming with information about finisher settings…. the search continues… maybe a different printer driver????
Gary, the details returned are indeed very print driver specific.
I’m recently getting around to using the cfprint but would like to know:
1. Will it print to a network printer that’s installed on CFserver? Meaning shared from a printer server
2. I am printing dynamic data i.e., parts produced by Lot, using cfreport to print 2" X .5" labels and I want lot quantities to output copies. Is this possible?
3. Do you have an example of what my code structure should look to include <cfreport> and <cfprint> tags in one page?
Ben, you mentioned earlier in this blog that this functionality may be included in a future release.
Do you know any java functions that will refresh the printers without having to restart the CF service? Occasionally, our list of printers seems to get corrupted and will return blank and chinese characters as the available printer names. Restarting the service fixes it but it’s a hassle and seems to be occurring more often. (cf9)