The LEADTOOLS ePrint 5 C DLL provides a mechanism for redirecting a print command to save the material in one or more image files. This requires creating a save device context (DC), which is obtained by calling the L_EpnCreateSaveDC function.
The created DC can be used as an ordinary printer DC. Each GDI command executed for this DC will be saved as a file with the file save options pointed to by the pSaveOptions parameter.
Before using the created DC, the user should call the StartDoc and StartPage Windows C DLL functions. After using the created DC the user should call the EndPage and EndDoc Windows C DLL functions.
The user should pass a pointer to an EPNPRINTERSAVEOPTIONS structure for the pSaveOptions parameter to the L_EpnCreateSaveDC function. The EPNPRINTERSAVEOPTIONS structure contains information about how to save the material, including the file name, file format, and other options. When the user sends a print command, the active material in the program from which the print command was sent is saved. If the user has opted to save the material as a multi-page file, each page of active material will be saved as a separate page within that multi-page file. If the material is to be saved in separate files, the files’ names are created using the file naming options provided in the NamingOptions member of the EPNPRINTERSAVEOPTIONS structure.
For OEM Printers:
If the OEM printer is locked, then the user can use it indirectly by using this function.
To use the locked OEM printer indirectly, pass a valid data to the pExtraOptions parameter. The pExtraOptions parameter is a pointer to an EPNEXTRADCOPTIONS structure. Please note that the pszPassword member of the EPNEXTRADCOPTIONS structure must be filled by the administration password that was used when the OEM printer was installed by calling the L_EpnInstallOEMPrinter function.
If the printer is locked and either NULL or an invalid password is supplied in pExtraOptions, the L_EpnCreateSaveDC function will fail and return NULL.
When the created DC is no longer needed, it should be deleted by calling L_EpnDeleteDC. For every DC created using L_EpnCreateSaveDC there must be a call to L_EpnDeleteDC to free it.
For more information about locking and unlocking OEM printers, refer to: