Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.10.23;
Скачать: CL | DM;

Вниз

Функция Printer и лазерные принтеры   Найти похожие ветки 

 
JB   (2005-10-03 13:48) [0]

Уважаемые Мастера! Подскажите пожалуйста в чем тут проблема.
Пишу программу (курсовая работа), и надо на принтер кое чего отправить, я использую функцию Printer. Дома где у меня струйник все работает, а на лазерниках (на всех которые мне попались под руку) из принтера вылазиет пустой лист бумаги.
                                                          Заранее спасибо


 
_RusLAN ©   (2005-10-03 16:57) [1]

У тебя ошибка в программе есть, из-за которой на струйниках печатается, а на лазерниках нет.

ЗЫ Ну как ответ? Помог?


 
Goral ©   (2005-10-03 16:57) [2]

я использую процедуру
procedure PrintStrings(S: TStrings; Font: TFont; Title: string); и все работает как на лазерниках так и на струйниках попробуй ;-)

//Printer pRoc
procedure PrintStrings(S: TStrings; Font: TFont; Title: string);
var
 LeftMargin, TopMargin, LineCoord, LineOnPage, LinesOnDoc,
 CurrentLine, TextHeight, LinesPerPage, LineInterval: integer;

 procedure StartDoc;
 begin
   LinesOnDoc := S.Count;
   Printer.Canvas.Font.Assign(Font);
   Printer.Canvas.TextOut(0, 0, " ");
   LeftMargin := (Printer.Canvas.Font.PixelsPerInch) div 2;
   TopMargin  := (Printer.Canvas.Font.PixelsPerInch) div 2;
   TextHeight := Abs(Printer.Canvas.Font.Height);
   LineInterval := TextHeight {+ (TextHeight div 2)};
   LinesPerPage := (Printer.PageHeight - TopMargin) div LineInterval;
   CurrentLine := 0;
 end;

 function MorePages:boolean;
 begin
   Result := (CurrentLine < LinesOnDoc) and
             not Printer.Aborted;
 end;

 procedure StartPage;
 begin
   LineOnPage := 0;
   LineCoord := TopMargin;
 end;

 procedure NextPage;
 begin
   if MorePages then Printer.NewPage;
 end;

 function MoreLines:boolean;
 begin
   Result := (LineOnPage < LinesPerPage) and
             (LineOnPage < LinesOnDoc) and
             not Printer.Aborted;
 end;

 procedure NextLine;
 begin
   Inc(LineOnPage);
   Inc(LineCoord, LineInterval);
   Inc(CurrentLine);
 end;

 procedure PrintLine;
 begin
   Printer.Canvas.TextOut(LeftMargin, LineCoord,
S.Strings[CurrentLine]);
 end;

begin
 Printer.Title := Title;
 Printer.BeginDoc;
 StartDoc;
 while MorePages do begin
   StartPage;
   while MoreLines do begin
     PrintLine;
     NextLine;
     Application.ProcessMessages;
   end;
   NextPage;
 end;
 Printer.EndDoc;
end;
// End Printer

procedure TForm1.Button1.Click(Sender: TObject);
begin
  PrintStrings(Memo1.Lines.Create,Memo1.Font,"");
end;


 
Anatoly Podgoretsky ©   (2005-10-03 18:22) [3]

Принтер НР


 
JB   (2005-10-04 09:39) [4]

2 Anatoly Podgoretsky
Оба принтера HP и лазерник и струйник


 
ANB ©   (2005-10-04 10:56) [5]


> JB   (04.10.05 09:39) [4]
- переключи лазерник на печать в графике.


 
Anatoly Podgoretsky ©   (2005-10-04 14:05) [6]

Любимая болезнь НР, помогают пляски с бубном.



Страницы: 1 вся ветка

Текущий архив: 2005.10.23;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.042 c
14-1128339203
Bryke
2005-10-03 15:33
2005.10.23
Остаться в живых


14-1128371301
yozh_programmer
2005-10-04 00:28
2005.10.23
Помогите найти саундтрэк к рекламе ...


14-1128424715
Layner
2005-10-04 15:18
2005.10.23
Как включить в трее Ru/En.. (XP/Sp2)


2-1127821155
Wolferio
2005-09-27 15:39
2005.10.23
ShellListView


14-1127983768
ThreeTONE
2005-09-29 12:49
2005.10.23
Потянет ли LPT порт такое?