AdobeStock_455007340

Server Side Printing In ColdFusion 8

Home » Server Side Printing In ColdFusion 8

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 responses to “Server Side Printing In ColdFusion 8”

  1. Ken Sykora Avatar
    Ken Sykora

    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. Dan G. Switzer, II Avatar
    Dan G. Switzer, II

    @Ken:
    While I don’t claim to be Ben, I would imagine this is targetted to companies who host their own servers and want to print things like invoices, nightly reports, etc.

  3. Anthony Avatar
    Anthony

    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.

  4. Ben Forta Avatar
    Ben Forta

    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

  5. Phil Hayes Avatar
    Phil Hayes

    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.

  6. Ben Forta Avatar
    Ben Forta

    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

  7. Rob Avatar
    Rob

    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?

  8. Robert Avatar
    Robert

    It this Windows only or does it work in CUPS as well?

  9. Sam Farmer Avatar
    Sam Farmer

    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)

  10. Damon Cooper Avatar
    Damon Cooper

    @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

  11. tony of the weeg clan Avatar
    tony of the weeg clan

    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!

  12. Mark Cadle Avatar
    Mark Cadle

    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?

  13. Juan Escalada Avatar
    Juan Escalada

    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…

  14. Lori Avatar
    Lori

    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?

  15. Ben Forta Avatar
    Ben Forta

    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

  16. Jeremy Avatar
    Jeremy

    Is there a function that returns a list of installed printers

  17. Paul Burbage Avatar
    Paul Burbage

    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.

  18. Ben Forta Avatar
    Ben Forta

    Paul, the tag right now supports PDF only. We may add additional formats in the future, but none decided on yet.
    — Ben

  19. Paolo Avatar
    Paolo

    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!

  20. Wil Genovese Avatar
    Wil Genovese

    Has anyone tried this from Redhat or Centos servers? We don’t use Windows for servers.

  21. Paolo Avatar
    Paolo

    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.

  22. Jason Delmore Avatar
    Jason Delmore

    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

  23. barry.b Avatar
    barry.b

    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)

  24. Andre Avatar
    Andre

    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?

  25. dylan Avatar
    dylan

    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

  26. James Mount Avatar
    James Mount

    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?

  27. barry.b Avatar
    barry.b

    @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

  28. James Mount Avatar
    James Mount

    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?

  29. Chris Avatar
    Chris

    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.

  30. Ray Grauberger Avatar
    Ray Grauberger

    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.

  31. James Mount Avatar
    James Mount

    Ray,
    I was having the same type of problem, but it was with text not printing properly. It looked fine in the pdf, but cfprint garbled it up. This was on ColdFusion 8.0.1. We fixed it by applying the most recent jpedal patch – jpedal processes pdf pages for ColdFusion. Find the patch at http://kb.adobe.com/selfservice/viewContent.do?externalId=kb405588

  32. Ed Avatar
    Ed

    This may help anyone looking for a server-side printing solution in CF7 Enterprise Edition: use Event Gateways to control the print queue. Just stumbled on it, might be useful…
    http://blog.monochrome.co.uk/2008/11/printqueue-pdf-printing-with-acrobat-reader-end-to-end-solution/

  33. Paul S. Avatar
    Paul S.

    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