Startseite ¦  was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews ¦  sonstiges
kylix ¦  tutorials ¦  online shop ¦  fotos ¦  Add&Win Gewinnspiel


Willkommen Gast. Bitte einloggen oder registrieren.
17.05.2012, 03:07:27
Übersicht Hilfe Suche Einloggen Registrieren

+  SwissDelphiCenter Forum
|-+  English Forums
| |-+  General Forum
| | |-+  Generic Printer & Winspool & Delphi
« vorheriges nächstes »
Seiten: [1] Drucken
Umfrage
Frage: What's wrong?
Generic/Text Printer   -0 (0%)
Winspool   -0 (0%)
Stimmen insgesamt: 0

Autor Thema: Generic Printer & Winspool & Delphi  (Gelesen 2585 mal)
Averwind
Newbie
*
Offline Offline

Beiträge: 1


« am: 25.01.2008, 14:13:18 »

I am trying to print line by line on a thermal printer using Windows generic printer drivers. The code I use to print a line is presented below. The code works OK. But the problem is the application freezes when there is a print operation. Is there something I am doing wrong? Should I use something else other than Winspool?

Procedure PrintLineToGeneric(Const line: string );
var
  BytesWritten: DWORD;
  DocInfo: TDocInfo1;
Begin
  if WinSpool.OpenPrinter(PChar(printerName), hPrinter, nil) Then
    //raise exception.create('Printer not found');
  Try
    DocInfo.pDocName := 'MyDocument';
    DocInfo.pOutputFile := Nil;
    DocInfo.pDatatype := 'RAW';
    If StartDocPrinter(hPrinter, 1, @DocInfo) = 0 Then
      Abort;

    Try
      StartPagePrinter(hPrinter);
      If not StartPagePrinter(hPrinter) Then
        Abort;
      try
        If not WritePrinter(hPrinter, @line[1], Length(line), BytesWritten)
        Then
          Abort;
      Finally
        EndPagePrinter(hPrinter);
      End;
    Finally
      EndDocPrinter(hPrinter);
    End;
  Finally
    WinSpool.ClosePrinter(hPrinter);
  End;
End;
Gespeichert
Seiten: [1] Drucken 
« vorheriges nächstes »
Gehe zu:  


Einloggen mit Benutzername, Passwort und Sitzungslänge

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006, Simple Machines LLC Prüfe XHTML 1.0 Prüfe CSS