Solved

Printing problem

Posted on 2016-08-12
2
80 Views
Last Modified: 2016-08-15
Hi,

I am using the following to send the info from a memo to the printer:

procedure TMainForm.PrintStrings(Strings: TStrings);    //sends the formula to the printer from the memo
var
  Prn: TextFile;
  i: word;
begin
  AssignPrn(Prn);
  try
    Rewrite(Prn);
    try
      for i := 0 to Strings.Count - 1 do
        writeln(Prn, Strings.Strings[i]);
    finally
      CloseFile(Prn);
    end;
   except
     on EInOutError do
       MessageDlg('Error Printing text.', mtError, [mbOk], 0);
  end;
end;

Open in new window


The problem is that the columns in the print don't line up like they do on the memo. Is there a way to tell the printer to use a non-proportional font ?
0
Comment
Question by:ChLa
2 Comments
 
LVL 37

Accepted Solution

by:
Geert Gruwez earned 500 total points
ID: 41754416
Set the printer font to a font like Courier new before writing
Printer.Canvas.Font.Name:='Courier New';

You'll have to left-align your text with spaces

Or use BeginDoc
Write everything like you would on a bitmap canvas
you'll have to calculate the proper proportionings
and then do EndDoc

Here is a sample of both ways:
http://oldsite.adug.org.au/PastMeetings/Presentations/DonMacraeOct96/default.htm
1
 

Author Closing Comment

by:ChLa
ID: 41756758
Thank you very much. Your answer helped me.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
delphi parse string to params 3 100
drawing animated level bar based on numbers 3 88
Delphi inherited method 6 63
Running cost per page (excluding the cost of the paper) 3 38
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now