View Full Version : Printing...

10-03-2007, 12:53 PM

When I go to print text in Delphi, and I have to say Printer.Canvas.Textout(100, 100, 'text'), do I have to set the X and Y properties?

Is there any way in which I can just do standard printing line after line without having to set the X and Y properties?

Thank you.

10-03-2007, 02:10 PM
I'm going to repeat what has been said several times before... whilst PGD exists to provide help when you need it, please try and find the answers yourself first, using google for example, or the search facility on the forums, instead of simply dropping a message here and waiting for someone to do the digging for you.

I ran a search on google for +"plain text" +"printing" +"delphi" and ended up with LOTS of hits, plus a link to search in google groups for the answer. The whole process took less than 30 seconds and hey presto I have an answer AND more importantly I've actually learned something I didn't know. Trust me when I say, by going off and hunting down answers to your questions yourself you will (a) become very profficient at google... a very useful skill in its own right and (b) learn more stuff as you root around the web looking for answers.

Heres an answer, it may not be exactly what you want as it prints using the printers default font, but it does allow plain text printing.


procedure TForm1.Button1Click(Sender: TObject);
MyFile: TextFile;
Writeln(MyFile, 'Print this text');

13-03-2007, 03:33 PM
Thank you, it works. :)