Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Report text file and fonts

edited December 2005 in General
Hi,
I've a DOS application that puts a text file into a directory waiting to be
printed.
My RB application intercept this file and show it in preview before print it
to a printer (laser, dot-matrix or bubble-jet printer).
The file to be printed is token "as it is" so I've no report templates
created. From a text pipeline the report app. do the preview directly.

But the font size must be automatically resized to fit in page the text file
before the preview. Also, I must print this file N lines per page (66,72 and
so on) by choice.

I've tryied to calculate (in the OnStartFirstPass event of ppReport) the
printable area (horizontal and vertical) with:

pw:=ppreport1.PrinterSetup.PageDef.spPrintableWidth
ph:=ppreport1.PrinterSetup.PageDef.spPrintableHeigth

and the size of actual font with

cw:=ppreport1.Printer.Canvas.TextWidth('H')
ch:=ppreport1.Printer.Canvas.TextHeigth('I')

and multiplying cw by the max line length of the file and ch by the
lines-per-page to obtain the max line pixels extension:

wsize:=cw*MaxLineLen
hsize:=ch*HowManyRows

if wsize>cw then
begin
if > 4 then

end

but it seems that they have different unit of measure, because the final
size of the font is too small (I stop the cycle at a size of 5 and this is
the final size). Also, I see that the wsize is too big respect to cw.
Peraphs using some conversion routine...(???) But which one?

Can you help me ?

Many thanks
Robert

Comments

This discussion has been closed.