Please enable JavaScript to view this site.

Raster Image Printer

Navigation: Automating the Printing Process

Using the Printer Script File

Scroll Prev Top Next More

Raster Image Printer's automation using a script file is the original technique used by programmers to automate printing, especially batch printing.

This type of automation has been grandfathered into the product to support existing customers already using this technique on previous versions of the driver. If you are just starting to automate using Raster Image Printer, we recommend starting with the following tools instead:

Using the PNSrv12 COM Object

The Script File

If you need to continue using the script file, see the section on Migrating to Version 12 for important script file changes.

Script file automation uses a file named PNPDF12S.INI to control the printer settings. This script file will override any settings that have been set in the printing profile set as the default profile for the printer. The script file is a text based Windows-style initialization file and lists all the settings that can be changed. The settings consist of a key-value pair for each property with related settings are organized into sections.

Automating using the script file allows you to accomplish the following workflow-related tasks. For example, a common use of the script file is to change the name or output location of the file created in between print jobs.

change driver settings "on the fly" before any print job

signal events at critical points during the printing process

use the events to perform thread-safe batch printing

The script file works by being placed in your Windows TEMP folder. You can find this folder quickly using the environment variable shortcut %TEMP%. This is usually the temp folder in the AppData folder for the logged in user, %USERPROFILE%\AppData\Local\Temp.

There is also a system temp folder under the C:\Windows\temp folder. In rare cases the script file is placed there.

Sample Script File

A sample script file is included in the \Setup folder as part of the installation. If you have installed the driver in the default location, the sample script file will be located in the following folder:

C:\Program Files\Raster Image Printer 12\Setup\PNPDF12S.INI

Normally, you would write to the script file only the settings you need to change. Go to Printer Script File Settings to see a listing of the values you can set in the script file.

Using the Script File

When automating, a script file should be dynamically created on an as-needed basis, and then deleted when you are finished with it. A built-in event is signaled by the print driver when it has read the script file and it is safe to delete it or change the settings for the next print job.

A pseudo-code outline of the printing process would look like the following:

1.Collect any needed information and create the script file with the necessary settings

2.Print the required document to the Raster Image Printer

3.Wait for the driver to signal that it has read the script file

4.Delete the script file

5.It is now safe to loop to step 1 and convert another file

This is only a very simple example. The above steps work for a single-threaded process but extra care must be taken when printing in multiple threads to share access to the script file.