Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения
KANSoftWare

Использование PASSTHROUGH для отправки данных прямо на принтер

Delphi , ОС и Железо , Принтеры и Печать

Использование PASSTHROUGH для отправки данных прямо на принтер

Оформил: DeeCo
Автор: http://www.swissdelphicenter.ch

{ 
  By using the Windows API Escape() function, 
  your application can pass data directly to the printer. 
  If the printer driver supports the PASSTHROUGH printer escape, 
  you can use the Escape() function and the PASSTHROUGH printer escape 
  to send native printer language codes to the printer driver. 
  If the printer driver does not support the PASSTHROUGH printer escape, 
  you must use the DeviceCapabilities() and ExtDevMode() functions instead. 


  Mit der Windows API Funktion Escape() kann man Daten direkt zum Drucker schicken. 
  Wenn der Drucker Treiber dies nicht unterstutzt, mussen die DeviceCapabilities() 
  und ExtDevMode() Funktionen verwendet werden. 
}

 //  DOS like printing using Passthrough command 
// you should use "printer.begindoc" and "printer.enddoc" 

type
   TPrnBuffRec = record
   bufflength: Word;
   Buff_1: array[0..255] of Char;
 end;

 function DirectToPrinter(S: string; NextLine: Boolean): Boolean;
 var
    Buff: TPrnBuffRec;
   TestInt: Integer;
 begin
   TestInt := PassThrough;
   if Escape(Printer.Handle, QUERYESCSUPPORT, SizeOf(TESTINT), @testint, nil) > 0 then
   begin
     if NextLine then  S := S + #13 + #10;
     StrPCopy(Buff.Buff_1, S);
     Buff.bufflength := StrLen(Buff.Buff_1);
     Escape(Printer.Canvas.Handle, Passthrough, 0, @buff, nil);
     Result := True;
   end
   else
     Result := False;
 end;

 // this code works if the printer supports escape commands 
// you can get special esc codes from printer's manual 

//  example: 
printer.BeginDoc;
 try
   directoprinter('This text ');
 finally
   printer.EndDoc;
 end;

Статья Использование PASSTHROUGH для отправки данных прямо на принтер раздела ОС и Железо Принтеры и Печать может быть полезна для разработчиков на Delphi и FreePascal.


Комментарии и вопросы


Ваше мнение или вопрос к статье в виде простого текста (Tag <a href=... Disabled). Все комментарии модерируются, модератор оставляет за собой право удалить непонравившейся ему комментарий.

заголовок

e-mail

Ваше имя

Сообщение

Введите код




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: Принтеры и Печать ::


реклама



©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru Rambler's Top100
20.04.2024 14:47:20/0.0035500526428223/2