I have a situation here where I need to print various .TXT files which has graphical characters i.e Alt+.., in it. All What I need is select the file print it after adjusting the font size. Please Help !
If you are just send .txt files to the printer, you may be able to simply use the built in Delphi TPrinter object and leave ReportBuilder out of the process.
----------------------------------------------- Tech Tip: Send TextFile to Printer -----------------------------------------------
I designed a application that exports the report to a .txt file using ReportTextFile device.
How can I Send the text file to the printer?
The following procedure will send the .txt file to the printer using Delphi's TPrinter object.
uses Printers;
procedure SendTextFileToPrinter(aFileName: String); var lsLines: TStringList; lOutputFile: TextFile; liIndex: Integer; begin
lsLines := TStringList.Create;
try lsLines.LoadFromFile(aFileName);
AssignPrn(lOutputFile); Rewrite(lOutputFile);
for liIndex := 0 to lsLines.Count-1 do Writeln(lOutputFile, lsLines[liIndex]);
Sending a text file to the printer is not a native feature of ReportBuilder, however I do believe it is possible to assign a font and send a text file to the printer using the TPrinter object in Delphi. It should just be a matter of assigning a font to the printer canvas, then drawing the text to that canvas before printing. Take a look at the TPrinter topic in the Delphi help for more information.
Comments
If you are just send .txt files to the printer, you may be able to simply
use the built in Delphi TPrinter object and leave ReportBuilder out of the
process.
-----------------------------------------------
Tech Tip: Send TextFile to Printer
-----------------------------------------------
I designed a application that exports the report to a .txt
file using ReportTextFile device.
How can I Send the text file to the printer?
The following procedure will send the .txt file to
the printer using Delphi's TPrinter object.
uses
Printers;
procedure SendTextFileToPrinter(aFileName: String);
var
lsLines: TStringList;
lOutputFile: TextFile;
liIndex: Integer;
begin
lsLines := TStringList.Create;
try
lsLines.LoadFromFile(aFileName);
AssignPrn(lOutputFile);
Rewrite(lOutputFile);
for liIndex := 0 to lsLines.Count-1 do
Writeln(lOutputFile, lsLines[liIndex]);
CloseFile(lOutputFile);
finally
lsLines.Free;
end;
end;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Thanks Nico !
But my problem is actually to change the FONT SIZE of the whole text
file, and then send it to the printer, is that possible ?
Thatchi
~~~~~~~~~~~
Sending a text file to the printer is not a native feature of ReportBuilder,
however I do believe it is possible to assign a font and send a text file to
the printer using the TPrinter object in Delphi. It should just be a matter
of assigning a font to the printer canvas, then drawing the text to that
canvas before printing. Take a look at the TPrinter topic in the Delphi
help for more information.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com