Components for Developers
© 2000-2008, Two Pilots

Virtual Printers Download Order EMF-printer Order PS-printer FAQ How to... Tutorials Testimonials Write us!

How to create Virtual Printer using: C++ | C# | Delphi | VB.NET | VB 

Virual Printer Tutorials: Sample Client Application

 

Sample client application used for testing and development purposes. This application demonstrates how to transfer information into an application. You can view the generated files by double clicking the line containing the file path.

Sample
Client Application for Virtual Printer Interface

To open the Properties Dialog for the Virtual Printer, click the Printer Preferences button.

Properties Dialog for Virtual Printer

 

What you need to create a Sample Client Application in C++/MFC

Read the registry to get the transfer mode used to send the INI file path from the virtual printer to the specified client application.

This option is stored in the registry branch "HKEY_LOCAL_MACHINE\SOFTWARE\Your Virtual Printer Example". The key is "Transfer Mode". In C++/MFC, the value of this parameter can be taken as follows:

// Get transfer mode related settings from the printer configuration
HKEY hKey = NULL;
DWORD dwSize = 0;
CString sKeyName;
CString sRegistryKey = "Your Virtual Printer Example";

sKeyName.Format("Software\\%s", sRegistryKey);
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, sKeyName, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
    RegQueryValueEx(hKey, "Transfer Mode", NULL, NULL, (BYTE*) &m_iTransferMode, &(dwSize = sizeof(int)));
    RegCloseKey(hKey);
}

Get the path to the INI file. The virtual printer sends the path of this INI file to a specified application using one of following transfer modes:

Parse the INI file with print job information and paths to the generated files. In C++/MFC it can be done as follows:

char szBuf[512] = {0};
CString sTemp;

// Show device name
GetPrivateProfileString("Device", "DeviceName", NULL, szBuf, sizeof(szBuf), sInputIniFilePath);

// Show print job (document) page count
GetPrivateProfileString("Document", "Pages", NULL,szBuf, sizeof(szBuf), sInputIniFilePath);

iCount = GetPrivateProfileInt("EMF", "Count", 0, sInputIniFilePath);

for (j = 0; j < iCount; j++)
{
    sTemp.Format("File%d", j);
	
    GetPrivateProfileString("PDF", sTemp, NULL, szBuf, sizeof(szBuf), sInputIniFilePath);
}

 

Download Sample Client Application:
Virtual Printer for C++/MFC
Virtual Printer for Delphi
Virtual Printer for C#
Virtual Printer for VB.Net
Virtual Printer for VB6
Virtual Printer for few languages

How to create Virtual Printer using: C++ | C# | Delphi | VB.NET | VB 

Virtual Printers Download Order EMF-printer Order PS-printer FAQ How to... Tutorials Testimonials Write us!

 

 

PDF Library | Virtual Printers | Converters to PDF

Support | Blog | Forum | Contacts | About
Site map

© 2000-2008, Two Pilots