lizzzard
asked on
Problems printing a simple textfile from Delphi
This is the first time I try to do this. Printing a textfile from a Delphi program. I'm not sure if I'm doing it the right way. I read the textfile line by line and copy the read line in a variable (string) then I call the method printer.canvas.textout(x,y ,string) in which x and y are variables updated elsewhere in the program. The debugger shows that the string is filled with lines from the textfile,but the method don't seem to work properly,because all I get after sending the job with printer.enddoc is an empty page. The debugger shows that the canvas is not updated by the method. I suppose I forgot something. Any body can help me out?
ASKER
What Icambe suggested is already the way I coded it. That's why I can't figure out why my printer doesn't print anything. (And eh.. it's not that I'm out of ink.)
Please send your whole print code.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok,problem solved. Thx
USES Printers;
IF PrintDialog1.Execute THEN BEGIN
WITH Printer DO BEGIN
BeginDoc;
....
canvas.TextOut( x, y, str );
.....
EndDoc;
END; {Of with printer}
END;
This should work for you.
Cheers,
Ian C.