For a change, I actually did some work at work today. For no reason other than what I can, starting today Im whipping up an online PDF generator application for the Commerce website. And as per usual, my solution is definitely not the most elegant on the planet.


Basically my application is structured as follows. I have a simple two page web interface which will allow the user to upload a file for conversion purposes. They will also be asked to include an email address with the upload, a vital part to my nefarious process (You can preview the upload page here: – obviously the system doesnt work yet though). All files get uploaded to a specific folder and are obviously renamed appropriately in order to avoid name clashes. The upload script uploads the file and straight after uploading the submitted file, creates an associated text file containing the submitted email address. Once this file is created, a blank complete confirmation file is generated as well.

Now behind the scenes we have the main application running on the server. The Watcher: PDF Generator simply implements a .NET folder watcher component, meaning it is basically polling a specified folder for any file activity. Once it detects a complete confirmation file in the input folder, it grabs the three associated files into its temporary folder where it begins the actual work. Using an asynchronous shell wrapper to basically run a command line call to an existing document converter (TotalDocConverter.exe), The Watcher allows a 3rd party application to generate the similarly named PDF file (Again the file is renamed to avoid name clashes, this time by appending a timestamp to the end). [Note I generally follow this procedure of wrapping existing applications to bend them to my will when I dont feel like recreating their functionality from scratch. Unethical? Yes. Life Simplifying? Most definitely!]

The generated PDF file is then moved to the specified output folder and its URL is then emailed to the supplied email address. This URL is active for 48 hours and should give the user plenty of time to snag their PDF document.

The Watcher: PDF Generator is also responsible for clean up duty, removing all unprocessed as well as processed files after a 48 hour grace period.

I started this application today and have completed the web interface section already. The main application is coming along nicely, so I should have this project wrapped up tomorrow then :)