Components for Developers & PDF Software → Virtual Printer Documentation

Contents of Virtual Printer documentation

  1. Components of the virtual printer
  2. Installation of the virtual printer from your application installer
  3. Uninstallation of the virtual printer

 

Introduction

Virtual printer can be used as a common printer.
User prints a document on the virtual printer and the specified client application receives pages of the printed document converted to specified formats.

 

1. Components of the virtual printer

Filename Description
SetupPrn.exe

Runtime package of all virtual printer files for easy integration with your deployment project. This executable is created with the Nullsoft Scriptable Install System (NSIS) (http://nsis.sourceforge.net/). See the SetupPrn.nsi script for details.
Use following command line parameters to install or uninstall the virtual printer:

/INSTDIR:"<installation_directory>" - printer files installation directory. It may be an installation directory of your main application or it's subdirectory.
/ACTION: INSTALL or /ACTION: UNINSTALL - installation action.

Samples:
installation: SetupPrn.exe /INSTDIR:"C:\Program Files\Your Virtual Printer Example" /ACTION:INSTALL
uninstllation: SetupPrn.exe /INSTDIR:"C:\Program Files\Your Virtual Printer Example" /ACTION:UNINSTALL

yvpepm.dll Core driver file (Windows 2000/XP/2003/Vista driver). Port monitor module.
yvpe.gpd Core driver file (Windows 2000/XP/2003/Vista driver). UNIDRV plugin configuration file.
yvpeui.dll Core driver file (Windows 2000/XP/2003/Vista driver). Module that adds additional property pages to system Printer and Document Properties dialogs.
yvpeui2.exe Core driver file (Windows 2000/XP/2003/Vista driver). Additional printer properties module to run from the system Printer and Document Properties dialogs.
yvpe.ini Core driver file (Windows 2000/XP/2003/Vista driver). Required driver configuration file.
setupdrv.exe Printer Driver Setup module. Adds new printer to the system.
Setupdrv.exe has following command line parameters:
/Q - silent installation (by default the setup module shows a message about successful installation);
/U - uninstall the driver (the same action as uninsdrv.exe);
/L "Language" - use specified language for messages. "English" value used by default. For localization enabled version only.
yvpe_s.lng Language file* for the driver setup module. Contains default (English) and translated messages used by the driver setup module. This file is optional.
yvpeagent.exe "Printing Agent". Resident module that runs the converter module and the client application.
yvpedisp.exe Converter module. Converts EMF images captured by the virtual printer to other graphics and document formats. Also implements the redirection feature.
progress.exe Progress Indicator module. The printing agent runs it before the conversion and terminates after.
Note: This module is optional. Also you can develop your own progress indicator. Just name it "progress.exe" and place in the same directory with the printing agent (yvpeagent.exe).
properties.exe Printing Preferences module. A property sheet with general printer options and the conversion options.
Note: This module is optional. You can handle all setting programmatically from your application. General printer settings (resoultion, orientation and paper formats) is available through standard GDI functions GetPrinter() and SetPrinter() (see source code snippets in the /Sample Application folder). Conversion settings can be handled through the registry (see registry options below).
yvpe.lng Language file* for the printing preferences module. This file is optional.
PDFCreatorPilot3.dll PDF conversion library.
SampleClient.exe Sample client application used for testing and development purposes only. See it's source code in /Sample Application folder.

* Language files are available and used only if you have purchased the Localization feature. Language files are simple INI-format plain text files. Non-english strings are stored in UTF-8 encoding. To add an additional language you need to open this file in any UTF-8-enabled text editor (e.g. the standard Notepad in Windows XP is UTF-8-enabled. Select UTF-8 encoding in Open File dialog.) and add new section [Language name] at the end of the file. Then copy all strings from the [English] section to the new one and translate them. Please be careful to keep UTF-8 encoding when saving the file. After you added new section in the language file, it will appear on the Language page of the Printing Preferences module. You can select new language and test translation on the fly - new translated strings will appear after restarting of the module.

 

2. Installation of the virtual printer

All necessary printer files are located in the /Files folder (/Files_x64 folder for x64 systems).

Printer integration steps:

2.1. Add SetupPrn.exe to your installation package.

2.2. Put a command to run SetupPrn.exe during the installation of your application. It will install the printer driver and add new printer in the Windows printers list. If the driver is already installed it will be re-installed (useful for "Repair" option available in many installers). Run SetupPrn.exe with command line paramters listed in the above table.
Example: SetupPrn.exe /INSTDIR:"C:\Program Files\Your Virtual Printer Example" /ACTION:INSTALL

2.3. Set up printer options using corresponding registry commands of the installer you use.

Global options:

These options must be placed to HKEY_LOCAL_MACHINE\SOFTWARE\<REGISTRY_KEY> registry key.

Option name Type Description Value Default
Client Application REG_SZ Full path to the client application to run by the printer.
For example: C:\Program files\My Application\MyApplication.exe
This option is obligatory.
   
Transfer Mode REG_DWORD Print job information transfer mode. 0 - through the command line
1 - through the WM_COPYDATA message
2 - through the clipboard
0
Target Window Title REG_SZ Unique title of the client application window.*    
Target Window Class REG_SZ Unique class name of the client application window.*    
Clipboard Format REG_SZ Unique name of the clipboard format. This option is obligatory for the clipboard transfer mode.    
Message ID REG_DWORD Unique numeric value to identify that the notification message has been received from the printer driver.
For the WM_COPYDATA transfer mode this value represents dwData member of COPYDATASTRUCT structure, so you will be able to discern the source of the received message.
For the clipboard transfer mode the Message ID represents an ID of the message your window will receive through the window procedure.
Message ID parameter is obligatory for WM_COPYDATA and clipboard transfer modes.
For WM_COPYDATA transfer mode the value must be in range from 0 to 4294967295 (0xFFFFFFFF).
For the Clipboard transfer mode the value must be in WM_APP range (from 32768 [0x8000] to 49151 [0xBFFF]).
0
Output Directory REG_SZ Output directory for genereated files. By default the virtual printer puts generated files into the user temporary directory (%USERPROFILE%\Local Settings\Temp). If you change this options you have to care about the write access right to new output directory for all required user accounts.
Note: New output directory must exist, otherwise files will be put to the user's temporary directory.
   

* Target Window Title and Target Window Class parameters are used with WM_COPYDATA and clipboard transfer modes. The printer uses them to identify the target window of your application that will receive the notification message. It's obligatory to set at least one of these parameters if you use the WM_COPYDATA or the clipboard transfer modes.

Additional options to show/hide property pages in the Printing Preferences dialog:

Option name Type Description Value Default
EMF: Hide page REG_DWORD This option hides EMF property page. 0 - show
1 - hide
0
BMP: Hide page REG_DWORD This option hides BMP property page. 0 - show
1 - hide
0
PNG: Hide page REG_DWORD This option hides PNG property page. 0 - show
1 - hide
0
JPEG: Hide page REG_DWORD This option hides JPEG property page. 0 - show
1 - hide
0
TIFF: Hide page REG_DWORD This option hides TIFF property page. 0 - show
1 - hide
0
PDF: Hide page REG_DWORD This option hides PDF property page. 0 - show
1 - hide
0
TXT: Hide page REG_DWORD This option hides TXT property page. 0 - show
1 - hide
0
SWF: Hide page REG_DWORD This option hides SWF property page. 0 - show
1 - hide
0
REDIRECT: Hide page REG_DWORD This option hides Redirection property page. 0 - show
1 - hide
0
LANGUAGE: Hide page REG_DWORD This option hides Language property page. 0 - show
1 - hide
0

Conversion options:

These options must be placed to HKEY_CURRENT_USER\Software\<REGISTRY_KEY> registry key.

If you want to initialize them for all users, you have to place initial values to HKEY_LOCAL_MACHINE\Software\<REGISTRY_KEY>\Defaults registry key.

Option name Type Description Value Default
EMF: Enabled REG_DWORD This option enables producing of EMF files. 0 - disable
1 - enable
0
BMP: Enabled REG_DWORD This option enables producing of BMP files. 0 - disable
1 - enable
0
BMP: Bits per pixel REG_DWORD This option sets color quality (bits per pixel) of BMP images. 1 - 1bpp (black and white)
4 - 4bpp color (16 colors)
8 - 8bpp color (256 colors)
24 - 24bpp (default)
24
BMP: Grayscale REG_DWORD This option sets BMP to 8bpp grayscale mode. If enabled, BMP: Bits per pixel parameter is ignored. 0 - grayscale mode off
1 - grayscale mode on
0
BMP: Dithering REG_DWORD Dithering algorithm to use for conversion of color images to 1-bit black&white images. The algorithms differ by speed and quality. 0 - Floyd-Steinberg (Default)
1 - Ordered-Dithering (4x4) (Fastest!)
2 - Burkes
3 - Stucki
4 - Jarvis-Judice-Ninke
5 - Sierra
6 - Stevenson-Arce
7 - Bayer (4x4 ordered dithering)
0
PNG: Enabled REG_DWORD This option enables producing of PNG files. 0 - disable
1 - enable
0
PNG: Bits per pixel REG_DWORD This option sets the color quality (bits per pixel) of PNG images. 1 - 1bpp (black and white)
4 - 4bpp color (16 colors)
8 - 8bpp color (256 colors)
24 - 24bpp (default)
24
PNG: Grayscale REG_DWORD This option sets PNG to 8bpp grayscale mode. If enabled, PNG: Bits per pixel parameter is ignored. 0 - grayscale mode off
1 - grayscale mode on
0
PNG: Dithering REG_DWORD Dithering algorithm to use for conversion of color images to 1-bit black&white images. The algorithms differ by speed and quality. 0 - Floyd-Steinberg (Default)
1 - Ordered-Dithering (4x4) (Fastest!)
2 - Burkes
3 - Stucki
4 - Jarvis-Judice-Ninke
5 - Sierra
6 - Stevenson-Arce
7 - Bayer (4x4 ordered dithering)
0
JPEG: Enabled REG_DWORD This option enables producing of JPEG files. 0 - disable
1 - enable
0
JPEG: Quality REG_DWORD This option sets the JPEG quality. Must be in range from
0 (min size)
to
255 (max quality)
40
JPEG: Grayscale REG_DWORD This option sets JPEG to the grayscale mode. 0 - color mode
1 - grayscale mode
0
TIFF: Enabled REG_DWORD This option enables producing of TIFF files. 0 - disable
1 - enable
0
TIFF: Bits per pixel REG_DWORD This option sets the color quality (bits per pixel) of TIFF images. 1 - 1bpp (black and white)
4 - 4bpp color (16 colors)
8 - 8bpp color (256 colors)
24 - 24bpp (default)
24
TIFF: Grayscale REG_DWORD This option sets TIFF to 8bpp grayscale mode. If enabled, TIFF: Bits per pixel parameter is ignored. 0 - grayscale mode off
1 - grayscale mode on
0
TIFF: Dithering REG_DWORD Dithering algorithm to use for conversion of color images to 1-bit black&white images. The algorithms differ by speed and quality. 0 - Floyd-Steinberg (Default)
1 - Ordered-Dithering (4x4) (Fastest!)
2 - Burkes
3 - Stucki
4 - Jarvis-Judice-Ninke
5 - Sierra
6 - Stevenson-Arce
7 - Bayer (4x4 ordered dithering)
0
TIFF: Multipage REG_DWORD This option enables generation of multipage TIFF file. 0 - separate TIFF file for every printed page
1 - multipage TIFF file
1
TIFF: Compression REG_DWORD This option sets TIFF compression. 0 - Automatic
1 - None
2 - CCITT modified Huffman RLE
3 - CCITT Group 3 fax encoding
4 - CCITT Group 4 fax encoding
5 - Lempel-Ziv & Welch
7 - JPEG DCT compression
32773 - Macintosh RLE
32946 - Deflate compression
8 - Adobe deflate compression
0
PDF: Enabled REG_DWORD This option enables producing of PDF files. 0 - disable
1 - enable
0
PDF: Separate REG_DWORD This option enables generation of separate TIFF file for every printed page. 0 - one multipage PDF document
1 - separate PDF files
0
PDF: Do not embed fonts REG_DWORD This option turns off the PDF font embedding. 0 - embedding on
1 - embedding off
0
PDF: Exclude fonts REG_SZ This option excludes specific fonts from embedding into PDF document. Enumerate fonts you want to exclude separating them with ";" symbol. For example:
PDF: Exclude fonts=Arial Unicode MS;Impact
 
TXT: Enabled REG_DWORD This option enables producing of TXT files. 0 - disable
1 - enable
0
TXT: Separate REG_DWORD This option enables generation of separate TXT file for every printed page. 0 - single continuous TXT document
1 - separate TXT files
0
TXT: Encoding REG_DWORD This options sets text encoding. 0 - ANSI
1 - Unicode
2 - UTF-8
0
TXT: Write BOM REG_DWORD This option sets writing of byte-order mark (BOM) at the beginning of Unicode and UTF-8 encoded text file. 0 - BOM off
1 - BOM on
0
TXT: Keep formatting REG_DWORD Try to keep approximate text formatting during the conversion to the plain text. 0 - ignore text formatting
1 - keep text formatting
1
REDIRECT: Enabled REG_DWORD This option enables the print redirection. 0 - redirection disabled
1 - redirection enabled
0
REDIRECT: Printer REG_SZ Name of printer to redirect to.    
REDIRECT: Watermarks enabled REG_DWORD This option enables watermarks. 0 - watermarks disabled
1 - watermarks enabled
0
Language REG_SZ Language of GUI and messages.    

 

3. Uninstallation of the virtual printer

3.1. To delete the virtual printer from the Windows printers list you should run SetupDrv.exe with /ACTION:UNISTALL command line parameter. Set it up to run during the application uninstallation process.
Example: SetupPrn.exe /INSTDIR:"C:\Program Files\Your Virtual Printer Example" /ACTION:UNINSTALL

Virtual Printer menu

Latest news

December 12 2011
Our driver now supports Windows 8

Send us your comments

We're really eager to hear from you. Please send us your suggestions in one of two ways: