You can refer to the web-to-print solution based on AJAX Vector Objects, Customer's Canvas. You can consider it as a ready-to-use editor that you may want to embed into your website or as an example demonstrating how AJAX Vector Objects can be used for your needs.
This topic describes how to configure AJAX Vector Objects to store temporary files in a cache.
It also describes different approaches for determining issues, which may occur when your application works on both the server and client sides.
When you launch an application using AJAX Vector Objects, it automatically creates a cache that preserves temporary files.
By default, the cache is located in
App_Data\FileCache of your web application.
However, you can configure the cache, changing its path and the time the files are stored. If you need to specify cache settings, create a section inside
the <configSections> tag of the
web.config file and specify parameters as the following snippet shows:
<configSections> <section name="Aurigma.GraphicsMill.AjaxControls.VectorObjects.FileCacheConfiguration" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> </configSections> <Aurigma.GraphicsMill.AjaxControls.VectorObjects.FileCacheConfiguration> <add key="RootPath" value="C:\AJAXVectorObjectSamples\App_Data\Cache"/> <add key="MaxFileLifeTimeSeconds" value="5000"/> </Aurigma.GraphicsMill.AjaxControls.VectorObjects.FileCacheConfiguration>
You can see from the snippet that the RootPath key allows you to change the path of the cache.
Note, that the value takes the absolute path as a parameter. The MaxFileLifeTimeSeconds value limits the time files are stored in the folder.
Remember, that the cache is cleared only when the application addresses it. Thus, even if MaxFileLifeTimeSeconds =
files in the cache will not be deleted automatically a second later unless the application accesses the cache.
AJAX Vector Objects provides flexible ways for determining and solving problems occurring when your application works. If an error occurs, AJAX Vector Objects writes a message describing the error to the System.Diagnostics.Debug by default. This means that you can see all the errors in the Output window in Visual Studio. For example, if you specify an incorrect path to fonts, you will see the following warning:
If you do not want to use Debug for debugging errors in your application, you can create your own logger. AJAX Vector Objects allows you to redirect all error messages to your logger. All you need to do is set the Configuration.LoggerFactoryMethod property. The following snippets demonstrate how to work with LoggerFactoryMethod:
Aurigma.GraphicsMill.AjaxControls.VectorObjects.Logger.ILogger logger = Aurigma.GraphicsMill.AjaxControls.VectorObjects.Logger.DotNetDebugLogger.Instance; Aurigma.GraphicsMill.AjaxControls.VectorObjects.Configuration.LoggerFactoryMethod = () =>logger;
For instance, to get CanvasViewer created in the Your First Application with AJAX Vector Objects article, we need to specify this command, as the following image illustrates: