#include <windows.h>
#include <stdio.h>
void PrintText(HDC hdc, const char* text) {
TextOut(hdc, 100, 100, text, strlen(text)); // Imprime el texto en las coordenadas (100, 100)
}
int main() {
DOCINFO di;
HDC hdcPrinter;
const char* text = "¡Hola, impresión a color!";
hdcPrinter = CreateDC("WINSPOOL", "HP Desk Jet 640c", NULL, NULL);
if (hdcPrinter) {
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = "Documento de prueba";
di.lpszOutput = NULL;
di.lpszDatatype = NULL;
di.fwType = 0;
StartDoc(hdcPrinter, &di);
StartPage(hdcPrinter);
// Cambia el color a azul
SetTextColor(hdcPrinter, RGB(0, 0, 255));
PrintText(hdcPrinter, text);
EndPage(hdcPrinter);
EndDoc(hdcPrinter);
DeleteDC(hdcPrinter);
} else {
printf("Error al crear el contexto de impresión.\n");
}
return 0;
}