Redirecting to Save to a File

LEADTOOLS ePrint 5 COM provides a mechanism for redirecting a print command to save material into one or more image files. This requires creating a save device context (DC), which is obtained by calling the CreateSaveDC method.

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 methods. After using the created DC, the user should call the EndPage and EndDoc methods.

The user should pass pointers to IEpnPrinterSaveOptions object for the pSaveOptions parameter, IEpnDeviceSettings object for the pDeviceSettings parameter, and IEpnExtraDcOptions object for the pExtraOptions parameter to the CreateSaveDC method. The IEpnPrinterSaveOptions object 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 file names are created using the file naming options provided in the NamingOptions property of the IEpnPrinterSaveOptions object.

For OEM Printers:

If the OEM printer is locked, then the user can use it indirectly by using the CreateSaveDC method.

To use the locked OEM printer indirectly, pass a valid data to the pExtraOptions parameter. The pExtraOptions parameter is a pointer to an IEpnExtraDcOptions object. Please note that the Password property of the IEpnExtraDcOptions object must be filled by the administration password that was used when the OEM printer was installed by calling the InstallOEMPrinter method.

If the printer is locked and either NULL or an invalid password is supplied in pExtraOptions, the CreateSaveDC method will fail and return NULL.

When the created DC is no longer needed, it should be deleted by calling DeleteDC. For every DC created using CreateSaveDC there must be a call to DeleteDC to free it.

For more information, refer to:

 Locking and Unlocking the OEM ePrint Printer