?
Solved

Delphi Newbie wants to print name and address onto an envelope

Posted on 2003-03-18
5
Medium Priority
?
222 Views
Last Modified: 2010-04-04
what I want to do is create a simple program where I get strings from TEdit/TMemo boxs and print it to a standard #10 envleope with indentation etc... useing TPagesetup & PBPrintersetup (Printersetup and saves the settings for the printer)

method of use is to input strings then tab to/press print button.

version is Delphi 6 pro

PLEASE HELP!
0
Comment
Question by:Murray_S
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
LukA_YJK earned 360 total points
ID: 8165020
TRichEdit has a Print method. It's the simlest way I think...
0
 

Author Comment

by:Murray_S
ID: 8166106
Ok been doing some stratching around so here is the code for the print button if this helps.

procedure TForm1.Button1Click(Sender: TObject);
begin
 with Printer do
begin
 BeginDoc;
 Canvas.Font.Size := 14;
 Canvas.Font.Name := 'Trebuchet MS';
 Canvas.TextOut(700,600, String(Name));
 Canvas.TextOut(700,700, String(Address.Lines)+ '   ' + string(pcode));
 EndDoc;
end;

Name and pcode are Tedit boxes
and Address is a Tmemo box

the positioning of the text is OK
it just prints out rubish

Any Ideas???
0
 
LVL 12

Expert Comment

by:andrewjb
ID: 8168189
var
  lIndex : integer;

Canvas.TextOut(700,600, Name.Text);
for lIndex :=0 to Address.Lines.Count - 1 do
  Canvas.TextOut( 700 , 700 + 20*lIndex , Address.Lines[lIndex] );

Canvas.TextOut( 700 , 700 + 20 * lIndex , PCode->Text );

or something like that
0
 
LVL 3

Expert Comment

by:LukA_YJK
ID: 8172375
It will print rubish because of low DPI (dots per inch) as far as understand. Did you try TRichEdit.Print? I think it must print at a good resolution at least...
0
 

Author Comment

by:Murray_S
ID: 8188296
this works but the box does not print properly
one line seems to print on top of the other...

can just use tedit boxes for the address and it works fine. But wuld like to know how to sort out the Tmemo problem though.

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question