Bonjour,
J'essaie d'imprimer sur une imprimante matricielle Epson LQ2090.
Je suis arrivé au code suivant:
Config:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 TCHAR* endLine = _T("\n\r"); TCHAR* txtLine = _T("Writing on printer test"); //Strats printing in a loop untill the count upto the GUI entered value. for (cnt =0; cnt<PrntCount; cnt++) { DWORD m_dwJobNumber = StartDocPrinter(hPrinter,1,(LPBYTE)&DocInfo); StartPagePrinter(hPrinter); bRet = WritePrinter(hPrinter,txtLine,_tcslen(txtLine)*sizeof(TCHAR),&written); bRet = WritePrinter(hPrinter,endLine,_tcslen(endLine)*sizeof(TCHAR),&written); EndPagePrinter(hPrinter); EndDocPrinter(hPrinter); Sleep(1000); //Wait for 8 seconds } ClosePrinter(hPrinter); //Closing the printer
Visual C++ 6.0 (vieux projet)
Windows XP Pro
Imprimante Epson LQ2090 matricielle
Impression via port réseau
Driver Epson LQ2090 officiel et à jour.
Test:
1) Code compilé en mode sans unicode (option _UNICODE dans les project setting
2) Code compilé en mode avec option unicode
Résultat:
1) compile, et execution ok, impression ok. Pas de problème.
2) compile, et execution ok, par contre pas d'impression:
problème: les jobs ont l'air d'être envoyé à l'imprimante:
- passe par le spooler windows
- imprimante passe en busy
- pas d'impression.
Pour info:
Le soft doit tourner en UNICODE (contrainte projet).
Observation:
Parfois, si après le test 2, je fais un LF(linefeed) sur le bouton de l'imprimante (action manuel), alors l'imprimante imprime ce que j'avais envoyé.
J'ai l'impression que en UNICODE, le linefeed ne passe pas, comme si l'imprimante recevait la ligne, mais attendé le LF pour imprimer.
Tout aide est la bienvenue, doc technique, faq. suis bloqué
Merci
Partager