This is the PHP console program service that Anthony and I programmed at work. We got the owner of the company to sign off a release form finally making the code available under the GPL.

Please note that this code will probably not work for you as a drop in place system, it will require tweaking, and lots of setup on your part. Please do not ask me for assistance.

Use this code at your own risk. You will need knowledge of Linux, PHP, Shell Scripts, and some common computer programming knowledge.

Folder structure for this program is as follows:
/tmp – Used for temporary storage of files for FDF merge into interactive PDF.
/usr/local/bin – Storage for all scripts this program uses. (dps.php, forge_fdf.php, file2pdf, pollerctl, dps_poller, hud-process.php)
/usr/local/dpsdocs – Root storage for following folders:
dpsdocs/merged – If save mode is on, saves raw ODT and PDF files in named folders.
dpsdocs/failed – Saves documents that failed to merge for some reason.
dpsdocs/monitor – If user chooses fake printer, will save the PDF here, instead of really printing it. Good for NFS/SMB share.
dpsdocs/templates – Live templates that the system pulls.
dpsdocs/test_templates – Test templates that you can SMB/NFS share for users to add tempaltes and you can sync to live later.
dpsdocs/xml_request – Where all the XML files get dumped to from which ever system you have generating them. Good to NFS/SMB share.

Files used and purpose:
dps.php – Main PHP program, does the merging and OOO operations. Takes in the XML as the first parameter and some others. Open file and view for yourself.
dps_poller – The program that loops continuously looking for newly dumped XML files. XML files that have specific printers are SCP’ed over the network to other servers running program so they build and print locally at that location.
file2pdf – This shell script gets called by dps.php and finishes the job, runs pdftk operations, and reads the sorting.txt file to decide where to print.
hud-process.php – Example PHP file that takes in FDF data and merges with specific PDF files. Called from dps.php.
pollerctl – Service script that makes sure the dps_poller is always running and never died for some reason.
tbs_class.php – TinyButStrong PHP class file, called from tbsooo_class.php.
tbsooo_class.php – TinyButStrong OpenOfficeOrg class file, called from dps.php.
zint – Console program that takes in data and creates a barcode. dps.php calls this, and creates a PDF417 barcode.

Document Processing PHP System