This one was not discussed during the usergroup tour, and I have not seen anyone mention it since we released the CF8 public beta, so …
If you’ve ever needed server-side printing under programmatic control, ColdFusion 8 introduces a new tag. prints PDF files (including those created using , and ) to a printer of your choice. At a minimum, requires just the name of the PDF file to be sent to the default system printer, but additional attributes can be used to specify the printer, copy count, the pages to print, as well as to pass lots of other printer settings. The list of available printers (and their names, as must be passed to )is listed in the ColdFusion Administrator. And a new supporting GetPrinterInfo() function returns all sorts of information about specified printers.

34 thoughts

  1. Hey Ben – this sounds great, but can you provide an example of when you would want to use a feature like this? What about those of us whose production environments are remotely hosted? Would we have to setup permanent VPNs and map printers using Windows to use this function?

  2. Yep as Dan said invoices and reports. Also would be useful if you wanted to setup some sort of print to fax and label printing.

  3. Yep, those are all good scenarios. The ones we heard from customers who asked for this were things like automatic generating order sheets when online orders come in, printing generated nightly reports, stuff like that. And no, this will not really be of use for remote hosted servers.
    — Ben

  4. We do exactly that right now, so I’m looking forward to an easier solution. I created a concoction of cfexecutes, bat files and a program to close acrobat after each PDF print. It’s a real pain in the x#&*%… but it works.
    We use it to send a PDF print job to a "broadcast" printer that in turn prints out at 8 different workstation printers.

  5. Phil, well you’ll be able to replace it all with:
    <cfprint type="pdf" pdf="mypdf.pdf" priner="Name Of Printer">
    Nice, huh? 😉 I’d love for you to try it out, if you can, grab the beta and see if it works for you, and then let us know.
    — Ben

  6. Ben,
    This great news, but…
    …does cfprint have arguments for network authentification or would the instance of the CF windows service have to "log on as" an account that the printers’ network server would permit?

  7. From my quick tests:
    – The user CF is running under has to have permissions to print.
    – Works on all platforms that CF supports (and I’ve run tests on my Mac)

  8. @Rob: the user the CF process is "running as" needs to have print queue rights, and have printers setup for it. That’s an OS/User thing. Once you’ve done this for the CF process user, you’ll see the list of configured and available printers (i

  9. im always working on a web based collections system i built for an atty friend, and printing lawsuits, is one thing i have automated with some pdf/fdf hacks… and one of the biggest things he’s been asking for, is printing automatically without the user having to hit the print button, the ok button, and then wait.
    now… with this, his wishes are answered 🙂 yummies!

  10. Another great feature that I was unaware of in CF 8. Today was the first day that we have been running everything on CF 8. This is GREAT! The upgrade was smooth as long as you uninstall any previous versions of cf and jrun. CFPrint is good because I played with it and as others have said, this good for intranets. I have a remote printer in another state that is on the network via IP and I was able to print to it from the app itself. So, now you can have orders go directly to a remote warehouse if they are on your network. SWEET! I love you CF, will you marry me?

  11. Ben I’ll give you another scenario: Imagine a grad school applicant filing up endless forms or personal info, sending their resume, cover letters and so forth… Now we have made the whole process easier by moving to an completely online application system allowing for digital document upload(.docs, .rtfs and .txt)… we use CF to capture all the info and ActivePDF to merge everything into a single file…
    I wonder if there is a Custom Tag or Com object that would allow us to use <cfprint on CF 7, since we are not quite ready to put CF8 in our production environment…

  12. We have a ColdFusion page that queries a database for ‘drawing numbers’. The numbers found are displayed on the screen to the user. When the user clicks on the drawing number, the drawing number is embedded into a link with a .pdf suffix on drawing number which then goes out to another directory on the server and opens the PDF. What we want to do is have a ‘Print’ button on the screen on which the users will click on and rather than the PDFs opening on the screen, have all of the PDFs found in the query automatically print to a local printer. Will <cfprint>l work in this scenario?

  13. Lori, sounds like you want client-side printing, and if so, then no, <cfprint> is for server-side printing. What you’d want is a "print me" option in the PDF itself, I think.
    — Ben

  14. What if I just want to stream other things to a printer, other than PDF. Is there any support for this in 8, or future, or in any handy dandy custom tags. Specifically, we have networked thermal label printers that we would like to server side print stream to.

  15. cfprint is a great feature. I use it to print labels, populating an existing PDF form model with custom data, but I cannot use any custom font in the form fields. For example, I need to populate a field that use a Code39 (barcode) font. CF populate the field correctly, and I also be able to open and print it correctly from Acrobat Reader, but when i use cfprint it not use the correct font, even if this font is correctly installed in "Server Settings > Font Management".
    Is this a bug or an undocumented cf standard edition limitation?
    I use CF8 on Windows Server 2003 & IIS6
    Thanks for your help!

  16. After 1 month of use I’M really sorry to say that I am absolutely disappointed with cfprint feature in CF8. <cfprint> is so full of bugs that is totally useless at this time.
    Yesterday I decided to give-up with this tag when I discovered that with more than 1 page to print <cfprint> print all pages in one page! Another bug… another week lost to find a way to bypass the problem… NO THANKS!
    <cfprint> was the main feature that convinced me to upgrade to version 8, but to solve my problems I need now to buy another software (I’M evaluating 3-Heights PDF Printer Service and seems to work very well…) and spend 1000.00 Euro to "finally" print something correct.
    I hope that Adobe will fix these bugs as soon as possible.

  17. Paolo,
    Have you submitted the issues you are having as defects? Are you on the ColdFusion prerelease program? We’d love to fix the issues you’re having, we just need to know what they are. 🙂
    Happy New Years!
    Jason

  18. any chance CFPRINT will print more than PDF documents? Word docs, Excel, etc. just throw a file name and path as one of the attributes? (the docs are stored on the server as a UNC path)

  19. Even I am having the weird cfprint problem. I’m only printing in Arial and the format is totally lost even though printing through Acrobat works.
    Is there a fix to this?

  20. Anyone have idea about the network share printer?
    because I installed the network share printer in CF8…
    but in coldfusion administrator It look cannot detec the printer i installed ?
    Regards,
    Dylan

  21. Ben,
    Does CFPrint support parallel processing? By this I mean: two users on two different workstations process two different .cfm pages in their Internet browsers. Each .cfm page has a cfprint tag referring to two different printers. The first user is printing a very large document, and it takes several minutes for JRun (or whatever java controls cfprint) to process the request and send the entire job to the printer. In the meantime, the second user is staring at a blank screen with a "waiting for page blah2.cfm" message, until the first user’s page completes. Is this serial-type behavior normal for ColdFusion printing or can I change a setting in the ColdFusion Administrator?

  22. @James
    I suggest you research how print queue’s work. What happens is that a print job is added to the queue of the printer attached to the server. When one job finishes the other starts.
    in your case, you have two seperate printers, with tw

  23. Thanks for the previous post, Barry.
    After playing around with cfthread, it seems that the threads only take priority over threads in the same page, not threads running on other pages. So when I run a print job on http://server1/page1.cfm and someone else runs http://server2/page2.cfm with cfprint inside cfthread with a HIGH priority, page2.cfm still waits for page1.cfm to finish. I need some way to manipulate ColdFusion’s "print queue."
    Anyone familiar with this phenomenon and how to correct or control it?

  24. It would be nice if you could print just a classic text file this way. As it is, I’m going to have to come up with a custom solution.

  25. Has anyone ever printed a graphic in their PDF file? I generate about 500 PDF files, Flatten the files, add a marketing page that is all graphics, add a graphic watermark for our folding machine using OMR, merge all files into one for printing. The when I try to use CFPRINT all graphics disappear. If I open the file manually all graphics are there and I can send it to the printer without losing graphics.

  26. how does one troubleshoot when CFPRINT all of sudden stops working? ex: CFPRINT appears to execute correctly, but nothing prints out and no print jobs are shown on the printer, nor does CF create a log entry to print.log

Leave a Reply