#include "Ltprinter.h"
L_LTPRINTER_API L_INT L_PrnGetRemoteData(pszPrinterName, nJobId, pJobData)
L_TCHAR * pszPrinterName; |
printer name |
L_INT nJobId; |
job ID |
PRNJOBDATA *pJobData; |
pointer to structure |
Obtains the remote data attached to the print Job ID.
Parameter |
Description |
pszPrinterName |
Character string that contains the printer name. |
nJobId |
ID of the job to retrieve remote data. |
pJobData |
Pointer to a PRNJOBDATA structure to be updated with the remote data. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
The L_PrnGetRemoteData function will obtain the pJobData structure data that was sent from the client machine printer driver, after the callback function L_PrnClntPrintJob was faired at the job is being printed.
Required DLLs and Libraries
For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your LEADTOOLS Network Virtual Printer Driver Server Application. |
Win32, x64.
Functions: |
L_PrnSetEnableNetworkPrinting, L_PrnSetNetworkInitialData, L_PrnIsNetworkPrintingEnabled, L_PrnGetNetworkInitialData, L_PrnInstallPrinter, L_PrnUninstallPrinter |
Topics: |
/* Job Callback */
L_INT EXT_CALLBACK OnNetworkJobInfoProc(L_WCHAR * pszPrinter,
DWORD dwJobID,
DWORD dwFlags,
L_VOID * pData)
{
UNREFERENCED_PARAMETER(pData);
USES_CONVERSION;
L_WCHAR szResult[ 250 ];
wsprintfW( szResult, L"Job ID: %d.\nOn printer: ", dwJobID );
lstrcatW( szResult, pszPrinter );
switch( dwFlags )
{
case PRN_JOB_START:
PRNJOBDATA jobData;
MessageBoxW( NULL, szResult, L"Starting", MB_OK );
//Read the remote data sent by the client machine
#if defined(FOR_UNICODE)
L_PrnGetRemoteData(pszPrinter, dwJobID, &jobData);
#else
L_PrnGetRemoteData(W2A(pszPrinter), dwJobID, &jobData);
#endif
if(&jobData == NULL)
return 0;
break;
case PRN_JOB_END:
MessageBoxW( NULL, szResult, L"Ending", MB_OK );
break;
default:
{
L_TCHAR szPrinter[_MAX_PATH];
memset(szPrinter, 0, sizeof(szPrinter));
#if defined(FOR_UNICODE)
wcscpy_s(szPrinter, pszPrinter);
#else
size_t num = 0;
wcstombs_s(&num, szPrinter, pszPrinter, _MAX_PATH);
#endif // #if !defined(FOR_UNICODE)
int nBytes = 0, nElements = 0;
TCHAR * pszString = NULL;
L_INT nRet = L_PrnGetEmbeddedFonts(TEXT("C:\\Path to font folder\\"), dwJobID, pszString, &nBytes, &nElements);
if (nRet == TRUE)
{
pszString = (PTCHAR) malloc(nBytes);
nRet = L_PrnGetEmbeddedFonts(TEXT("C:\\Path to font folder\\"), dwJobID, pszString, &nBytes, &nElements);
for (int i = 0 ; i < nElements ; i++)
{
TCHAR * strFont = &pszString[MAX_PATH * i];
MessageBox(NULL, strFont, TEXT("Font Received"), 0);
}
free(pszString);
}
L_PrnCancelPrintedJob(szPrinter, dwJobID);
}
}
return 1;
}
L_VOID NetworkPrinterExample( )
{
int nRet = L_PrnRegisterJobCallback(TEXT("TEST LEADTOOLS Printer"),OnNetworkJobInfoProc,NULL);
// Enable network printing
L_PrnSetEnableNetworkPrinting(TEXT("TEST LEADTOOLS Printer"), TRUE);
L_BOOL bEnableNetwork = FALSE;
// Check if network printing is enabled
L_PrnIsNetworkPrintingEnabled(TEXT("TEST LEADTOOLS Printer"), &bEnableNetwork);
if(!bEnableNetwork)
return;
L_CHAR *pCharData = "Network Printer Initial Data\0";
L_LONG nInitialDataLenght = (L_LONG)strlen(pCharData);
// Set Initial Network Data
L_PrnSetNetworkInitialData(TEXT("TEST LEADTOOLS Printer"), (L_UCHAR*)pCharData, nInitialDataLenght);
HGLOBAL hGlobal = NULL;
L_LONG nGlobalDataSize;
// Get Initial Network Data
L_PrnGetNetworkInitialData(TEXT("TEST LEADTOOLS Printer"), &hGlobal, &nGlobalDataSize);
if( nGlobalDataSize == nInitialDataLenght)
{
//Data set shoud be equal to data returned
return;
}
if (nRet == SUCCESS)
{
L_PrnUnRegisterJobCallback(TEXT("TEST LEADTOOLS Printer")) ;
}
}
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET