Components for Developers & PDF Software → 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

Virtual Printer menu

Latest news

April 27 2010
Now we have a new service: the development of POS-printer.

Send us your comments

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