L_PrnGetRemoteData

Summary

Obtains the remote data attached to the print Job ID.

Syntax

#include "Ltprinter.h"

L_LTPRINTER_API L_INT L_PrnGetRemoteData(pszPrinterName, nJobId, pJobData)

Parameters

L_TCHAR * pszPrinterName

Character string that contains the printer's name.

L_INT nJobId

ID of the job to retrieve remote data.

PRNJOBDATA *pJobData

Pointer to a PRNJOBDATA structure to be updated with the remote data.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

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

Platforms

Win32, x64.

See Also

Functions

Topics

Example

/* 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")) ; 
   } 
} 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Virtual Printer C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.