When printing labels, the error "A call to Windows API CreateDC failed" might appear
Article ID: 257 - Updated: Dec 18, 2017 - Products: All products - Version: Any - Category: Printing
When you try to print label from NiceLabel software, the print action fails and application displays the error message such as:
A call to Windows API CreateDC failed
The problem might not replicate for every printer that you have installed. You could be able to print to some printer, but not to the other.
As the error message tries to explain, the Windows API call CreateCD failed and printer driver cannot be used. Deep in its core NiceLabel software uses the programming calls (API call) to the Windows functions. In this case, NiceLabel communicates with the printer driver and queries the printer capabilities with the CreateCD function call.
NiceLabel software executes this API call every time before the Print action. NiceLabel creates a reference to the printer driver with the call. One of the input parameters for the function is DEVMODE structure. DEVMODE describes the capabilities and settings of the selected driver.
The API call might fail when label is created for one driver and you want to print it using another driver. In this case, the driver settings provided in DEVMODE structure from the current driver must be merged with settings from a new driver. Some printer drivers have troubles with the merge and cause the error.
- Make sure that you are using the latest available printer drivers.
- Do not use the option Use custom printer settings saved in the label. This option saves a copy of driver DEVMODE inside the label. The driver settings become part of the label. However, if you select another printer driver for printing, merge of the current driver's DEVMODE will happen with the DEVMODE from the selected driver. Some printer drivers have troubles with such data merge and will create incorrect DEVMODE structure, resulting in the error.
If this is the case, disable Use custom printer settings saved in the label and enable Use default printer settings from the printer driver. These two options are accessible in Label Properties dialog box in NiceLabel Designer.
- Create a label variant specific for the target printer. In this case, no merge of DEVMODE will be made, as the DEVMODE already fits the target driver.