BF Guest
|
Posted: Thu Feb 16, 2006 4:03 pm Post subject: Delphi 7 Printing problems |
|
|
Hi everybody,
i'm finding several problems in development of a simple printing
application.
If this isn't the right NG for this kind of issue, please redirect me to
the right one.
[i'm sorry for my bad English]
I have to print simple text from a file on a thermal printer (a Zebra
Z4M), on a set of labels, for industrial purpose.
Code is the following
Function _Print(fileToPrint:String):boolean;
var fileIn:File Of Char;
fileOut:TextFile;
sRow:String;
cBuffer:Char;
begin
If Printer.ExecuteSetup then
begin
AssignFile(FileIn, fileToPrint);
AssignPrn(FileOut,Printer);
Reset(FileIn);
ReWrite(FileOut);
sRow:='';
cBuffer:=#0;
while not Eof(FileIn) do
begin
Read(FileIn,cBuffer);
sRow:=sRow+cBuffer;
end;
Write(fileOut,sRow);
CloseFile(FileIn);
CloseFile(FileOut);
_Print:=True;
end
Else _Print:=False;
end;
As you see, this routine is very simple.
When it starts printing, all seem to go in the right way.
But it can happen that some labels to print are missed during printing
process. For example, I printed a job of about 700 labels; at the end, i
noticed that about 10 labels (randomly distributed) were not printed.
Than i tried to run that job again... exactly the same result (same
labels missed)!!!
So i thought that those missed labels could contain special characters,
not correctly "recognized" by printer: so i tried to "cut" those labels
from text file they came from and print them manually. No problems...
printing was successful, no label missed.
All these tests were done on a machine with Windows 2000.
Could it be a buffering problem? And, if so, is it possible that exactly
the same labels were not printed in two following jobs?
What can I do? Is there another way to print text files in delphi?
Thank you very much for your support.
Fabrizio |
|