coldfusion - cfprint issues with large spool files

混江龙づ霸主 提交于 2019-12-24 03:35:07

问题


I am using cfprint from ColdFusion to print multiple PDFs from a directory. The problem I am having is that when the files are spooled to the printer the size of the file dramatically increases and slows down everything. The file in the folder is 125K and when it is in the printer spool it increases up to 15.7MB. Here is the ColdFusion code:

<cfprint 
    source="[FILELOCATION]/[FILE].pdf" 
    color="yes" 
    printer="[printer name]">

The files will eventually print but it can take upwards of 15-20 minutes. Does anyone have any solutions for this issue? I have tried with both CF generated PDFs and ones that I have created from scratch. Thanks


回答1:


Queue up two to five at a time. Pause to allow processing. Mark them as printed, move or delete them, move to the next batch...Time this out yourself to see how much time you need to allow. That way you don't compound a bunch of work for the server and create a bottleneck on your CF server.

If you are just doing this with one server consider using a secondary low priority server and run a developer edition fully paid for EULA compliant registered version of Coldfusion (or Railo) and dedicate that server for just printing so your other server can do useful things.

Edit

So the OP has a Coldfusion print bottleneck. In your server that does the printing (same as your CF server I assume?) and IF this is a windows server (not sure your server version), there is print queue folder. Provided you have access to this folder, you can do a few things. You can create a method for FTP-ing your files to this folder (or copy if it is the same server). The printer will queue up the job and off it goes. You can do some functions like check the print queue for file count. If the file count is greater zero, check back in 15 minutes. If the count is zero, copy over a few more files.

You be creating a scheduled task in your CFAdmin and automate. There is a getprinterInfo() so you can check if the printer is off line and do other things like check for another printer somewhere else if you need to reroute print jobs. You can also set up several print servers and attach printers to them and hit several print servers and check print queue folders.

The magic is endless, goal is to offset work to something other than your Coldfusion server.

So to recap:

  • Seperate concerns by not doing cfprint
  • Create escape routes to other priters if you can.
  • If you must use coldfusion then queue up a dedicated Coldfusion server for print management stuff.
  • Use getPrinterInfo() and dump out things to see what you can use, trap etc.
  • Ben forta has a tool that can check for several printers, consider incorperating this.
  • Next use cfftp (or cffile if you are on the same server) provided you have access and copy files to print queue folders, doing no cfprint at all.

Here is a link on print spool stuff (another link in the doc shows you how you can change the spool location).

When it is over you are going to be the coldfusion print master with escape routes and checks and everything.



来源:https://stackoverflow.com/questions/24294383/coldfusion-cfprint-issues-with-large-spool-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!