40

This is my basic understanding of how to make a printer available to use in ColdFusion.

  1. Remote into the server running CF using the account that the CF service is running under.
  2. Open the windows control panel and add the printer.
  3. Restart the CF service.

My question: is there any way to reload the printers without restarting the CF service?

This is the issue we are trying to troubleshoot. CF error detail:

Error: Printer \\(server)\(printerName) is not available. Available printers are: , şៈ᠘, , , , 凙ᜀᚈ, , 疠쐵䚏, , .

Restarting the CF service fixes this but it seems to be happening pretty often lately. I am wondering if there is some java code to reload the printers so it can be done automatically. We are using CF9.

Hossein Narimani Rad
  • 31,361
  • 18
  • 86
  • 116
jessieloo
  • 1,759
  • 17
  • 24
  • There is CF administrator interface which may provide this capability - I moved away from CF few years ago, so this is from my memory – Germann Arlington Mar 13 '14 at 14:08
  • 6
    If (and only if) CF talks to printers "The Java Way", then this might be related: http://bugs.java.com/view_bug.do?bug_id=4744405. It says that it's fixed in "Java 6, build 33", which I suppose includes Java 6 after update 1 (not sure about this). Furthermore, it's clear that even with the appropriate java version, the application (CF) is going to have to call [javax.print.PrintServiceLookup.lookupDefaultPrintService()](http://docs.oracle.com/javase/7/docs/api/javax/print/PrintServiceLookup.html#lookupDefaultPrintService()) in order to get a refreshed list. – daveloyall May 23 '14 at 19:28

3 Answers3

1

To use a network printer ColdFusion is going to need to be running under a domain account that has permissions to network resources. The default user that the ColdFusion Windows Service runs under is localSystem. This user account normally has lots of permissions to the local system but no permissions on the network. The usual solution is to create a domain account for this purpose and then set the ColdFusion Windows service to run as that user in the Services Control Panel.

I recently installed a printer on my server machine, and it was detected right away without any issues. I am using CF10 on a Windows 7 64-bit system. So the following code listed my printer without any restart of the service at all:

<cfdump var="#GetPrinterInfo()#">

Hope this would help.

Anurag
  • 1,018
  • 1
  • 14
  • 36
  • Very interesting question. Same as you I faced this same problem in the past...after working around and going through every possible tweaks and settings to mess around....I finally found out it was the problem with account permission...user policy and subgroups. In my situation I was able to fix it. Please let me know if you find a solution for yours. Does this solve the problem or thr is more to it. Thanks. – Anurag Jan 19 '15 at 17:03
0

I have worked with Java and printers and as stated by daveloyall in the comments the problem might come from Java. Tests have shown that when you launch a java application, it takes a snapshot of the current printers list and never updates it so the only way to refresh the printer list is to restart the application.

Padrus
  • 2,013
  • 1
  • 24
  • 37
0

Yes, a sudo would sort it out... Or, the sysadmin setting the synch to a shorter interval (but that would increase the CPU time allocated).