Hello,
I understood I have to prepare the text in other tool like QuickReport or WPTools, but as my text will be very simple, could I use just a standard Borland Memo control?
Thanks for the answer.
Hello,
I understood I have to prepare the text in other tool like QuickReport or WPTools, but as my text will be very simple, could I use just a standard Borland Memo control?
Thanks for the answer.
Hi,
Yes, this would work, too. You need to print your memo line by line
and increment the y position on the page.
This is an example of a console application which prints the file mentioned in commandline.
var PDFPrinter : TWPPDFPrinter;
filename : string;
f : TextFile;
x,y, i : Integer;
line : string;
canvasres : Integer;
begin
PDFPrinter := TWPPDFPrinter.Create(nil);
PDFPrinter.AutoLaunch := TRUE;
PDFPrinter.CompressStreamMethod := wpCompressFlate;
PDFPrinter.FontMode := wpEmbedTrueTypeFonts;
PDFPrinter.CreateThumbnails := TRUE;
try
filename := ParamStr(1);
if filename<>'' then
try
Reset(f,filename);
PDFPrinter.Filename := ChangeFileExt(filename,'.PDF');
try
PDFPrinter.BeginDoc;
repeat
PDFPrinter.StartPage(Round(8.5*72),Round(11*72),72,72,0);
canvasres := PDFPrinter.Canvas.Font.PixelsPerInch;
PDFPrinter.Canvas.Font.Name := 'Courier New';
PDFPrinter.Canvas.Font.Size := 11;
x := Round(0.5*canvasres);
y := Round(0.5*canvasres);
repeat
ReadLN(f, Line);
PDFPrinter.Canvas.TextOut(x,y,Line);
inc(y,PDFPrinter.Canvas.TextHeight('Ag'));
until Eof(f) or (y>Round(10.5*canvasres));
PDFPrinter.EndPage;
until Eof(f);
finally
PDFPrinter.EndDoc;
end;
finally
CloseFile(f);
end;
finally
PDFPrinter.Free;
end;
end.
Alles anzeigen
Many thanks for your detailed answer! :shock:
I will try it (but in BCPP6) it and tell you in case I found any trouble.
Kind regards,