When printing labels, the error "A call to Windows API CreateDC failed" might appear
Article ID: 257 - Updated: Feb 10, 2021 - 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. You can print to some printers, but not to the others.
The error message indicates that the Windows API call CreateCD failed and printer driver cannot be used.
NiceLabel 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 creates a reference to the printer driver with the API 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 the 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 printer properties saved in: 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, a 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, select Use printer properties saved in: Printer Driver. These two options are accessible in the Label Properties dialog box in NiceLabel Designer.
- Create a label variant specific for the target printer. In this case, there is no merge of DEVMODE, as the DEVMODE already fits the target driver.