ceTe Software Help Library for .NET - July 2009
DynamicPDF WebCache Comments on this topic
See Also

Glossary Item Box

What is DynamicPDF WebCache?

DynamicPDF WebCache, in simple terms, is a file cache management system for PDF documents.  DynamicPDF WebCache facilitates the automatic saving and retrieving of the PDF files from a dynamically determined location on the server (outside of the web root) and the automatic clean up of those cached files (at user specified intervals).  With WebCache, developers can now have direct access to these cached files without ever needing to know the files exact location on the file system.

DynamicPDF WebCache is designed to work in Web Applications where you would want to save a PDF for a specified period of time and you want to have the ability to easily retrieve those files (immediately or at a later time). A GUI configuration utility is also available to configure all the WebCache settings. If PDF files need to be sent directly to the end user's browser without needing to save a temp file on disk, WebCache does not need to be used.  For sending documents directly to a user's browser, the Document's (or MergeDocument's) DrawToWeb method will achieve this.

Why Use DynamicPDF WebCache?

There are many reasons to use DynamicPDF WebCache. Here are a few of them:

How does DynamicPDF WebCache work?

DynamicPDF WebCache consists of three parts:

Once DynamicPDF WebCache is installed on a server, a PDF can be created using DynamicPDF Generator, Merger, ReportWriter or Converter and can be saved through DynamicPDF WebCache (see the example below for source code details).   Saving the PDF document using DynamicPDF WebCache will allow you to access that file at a later time.

NOTE: When setting up a new website the "Location" specified in the "New Website" dialog box should be set to "HTTP" not "File System".  Since websites with a "Location" set to "File System" do not go through IIS, the WebCache ISAPI filter will not be applied.

DynamicPDF WebCache Service

The purpose of the DynamicPDF WebCache Service is to periodically clean up the files in the cache. It will be an NT service and must be running in order to clean the cache. The service can be stopped and started, but not paused. When the service starts it immediately performs a clean up of the cache. It then performs a cleanup at the Cleanup Interval. A cleanup is performed by checking the names of the folders in the cache. Any folder that was not created between the current time and the current time minus the cache period should have all its files deleted and then the folder itself should be deleted. If any files are locked, that file can be left for the next cleanup cycle.

DynamicPDF WebCache Configuration Utility

By default all setting are changed using the Configuration Utility (C:\Program Files\ceTe Software\DynamicPDF WebCache v1.0\DynamicPDF.WebCache.Config.exe).  There are only three settings associated with DynamicPDF WebCache.  The settings are as follows:

It is recommended that the Cleanup Interval be relatively smaller than the Cache Period.  Also, any changes to the values in the configuration utility require a restart of IIS in order for those changes to take affect.

DynamicPDF WebCache Installation

In most cases installing DynamicPDF WebCache will be done by running the installer package (the MSI) on the server that you would like the WebCache functionality to be running on.  Both the ISAPI filter and the service are set up and started when the installer package (the MSI) is run.  During the installation, you will select the specific web site(s) to install the ISAPI filter on. 

For steps on how to perform manual installation click here

Integration with other DynamicPDF Products

DynamicPDF WebCache seamlessly integrates with all DynamicPDF .NET products. Any DynamicPDF Document object has a DrawToWebCache method that is used to save the PDF in the setup WebCache.  This DrawToWebCache method returns a WebCacheItem object and the Redirect method of the WebCacheItem class can output the PDF to the browser. The Redirect() method maps to the URL where the PDF file gets stored in the cache.  The WebCacheItem returned from the DrawToWebCache object also contains a FilePath property that should be used whenever a direct file path to the PDF is needed.  For example this FilePath property would be used if you wanted to attach a cached PDF to a dynamically created email. Click here for an example.

See Also

©2009. All Rights Reserved.