Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Delphi Newbie wants to print name and address onto an envelope

Posted on 2003-03-18
5
Medium Priority
?
227 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
  • 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

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses
Course of the Month11 days, 10 hours left to enroll

564 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