PEERNET
Overview

The Script File is one of the simplest forms of controlling one of the PEERNET Printers. By default, each major release of a PEERNET Image Printer, since version 5, has a default Script File that it reads to override any settings specified in the printing preferences, document preferences or default preferences of the printer.

The script file can override some or all of the settings. The choose is yours.

The location of the script file is by default the user's TEMP folder, but you can specify a specific location by setting a key in the registry associated with the printer, named Scripting file.

Using a script file is NOT thread-safe unless you the developer take care to ensure it is.

The basic processing model is as follows:

  • Step 1: Create a script file assoicated with the target printer with the desired settings.
  • Step 2: Print the document to the target printer.
  • Step 3: Delete the script file once document has started spooling or started printing or process commands event has been signalled.
  • Step 4: go back to step 1 for next document.

Special care must be taken to ensure this process is thread-safe.

The Watch Folder example demonstrates using the script file with the TIFF Image Printer 8.0.013 in a desktop application; where as the Windows Service example demonstrates using the script file with the TIFF Image Printer 8.0 in a Windows service.

Both examples monitor an input folder where files are picked up for conversion. However, unlike the COM examples, job tracking information is not available nor is there the ability to use a pool of printers to increase the throughput or performance of processing when you need to convert a large volumne of documents.

Watch Folder

This sample will convert all Excel or Word files in the specified folder to TIFF images using the TIFF Image Printer 8.0 and a script file to control the driver settings. It demonstrates using the printer driver and a script file in a highly threaded environment and how to safely change the script file settings between threads.

The sample program also uses late binding to communicate with Word and Excel, instead of the more common early-binding method of adding a reference to the Word or Excel object directly into the project.

The sample program is a C#.NET application written in Visual Studio 2008. You will need the following:

  • Visual Studio 2008 to compile and edit the sample application. You do not need this to run the sample; an setup program to install the sample application is included.
  • Microsoft .NET Framework 2.0 or higher must be installed as the sample application targets Microsoft .NET Framework 2.0.
  • TIFF Image Printer 8.0.013 or higher must be installed. The product can be in trial mode, and is available here.
  • The sample application converts Word and Excel documents using late binding to communicate with whichever version of Word or Excel is installed on the computer.

A zip file containing the sample, named Multi-Threaded Automation, can be downloaded here. The download contains a setup program to install the application. You do not need Visual Studio 2008 to run the sample but if you want to compile and edit the sample you will need Visual Studio 2008.

Windows Service

This C# sample service creates and monitors an input folder for text files (*.txt). A timer is used to poll the input folder every 15 seconds. Any files dropped into the folder are converted to TIFF images using a named copy of TIFF Image Printer 8.0. When the output files are created, the source files are moved from the input folder to a processed folder. A event log named TIFFToText is also created and used to log messages from the service.

The sample program is a C#.NET application written in Visual Studio 2008. You will need the following:

  • Visual Studio 2008 to compile and edit the sample application. You do not need this to run the sample; an setup program to install the sample application is included.
  • Microsoft .NET Framework 2.0 or higher must be installed as the sample application targets Microsoft .NET Framework 2.0.
  • TIFF Image Printer 8.0 must be installed. The product can be in trial mode, and is available here.
  • Administrative privileges are required to install and remove services.

A zip file containing the sample, named TIFF Service, can be downloaded here. The download contains a setup program to install the application. You do not need Visual Studio 2008 to run the sample but if you want to compile and edit the sample you will need Visual Studio 2008.


Copyright © 1997-2010. All rights reserved. Legal notice.
PEERNET® is a registered trademark of PEERNET Inc.

Saturday, February 04, 2012