[Lazarus] Anyone using LCLIntf critical section routines?

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Sun Jun 22 20:35:40 CEST 2008


On Sun, Jun 22, 2008 at 12:58 PM, Dave Coventry <dgcoventry at gmail.com> wrote:
> Currently I have to measure the page I want to print and use the
> Canvas draw commands to draw the page. If anything changes I have to
> measure the page again and input the data in terms of lineto, moveto
> and textout methods.

What do you need? Just the size of the paper?

If you are using "normal" paper, you can let LCL calculate the size by
simply giving the paper name to it:

uses Printers;

Printer.papersize.papername := 'A4';

PaperWorkRect := Printer.PaperSize.PaperRect.WorkRect; // This holds
the printable area of the paper

Printer.PaperSize.PaperRect.PhysicalRect holds the entire paper,
including areas that the printer won't be able to print to.

Example of printing using this:

Printer.BeginDoc;
Printer.Canvas.TextOut(PaperWorkRect.Left, PaperWorkRect.Top, 'TextOut');
Printer.EndDoc;

You can use TPrinterDialog to let the user choose the paper.
Printer.papersize.papername will be automatically updated.

I am writing about this in the Lazarus book.

> What I'm hoping to do is to format the page using OpenOffice and then
> convert this to moveto, lineto, textout, etc.

You will have a lot of difficulty to communicate with OpenOffice.

> PCL uses similar methods, penup, pendown, etc; maybe I could format
> the page and output it to PCL and then convert the PCL to
> TPrinter.Canvas functions?

What is PCL?

> Maybe even Postscript? I used to have the
> old Adobe "Postscript Cookbook". If I could just find it again...

I am building a CNC Machine, and I also need to read data from an
external software. I analised Postscript and I arrived to the
conclusion that it is too complex to build a Postscript interpreter
(Postscript is a full programming language!).

We have decided now to build a PDF reading library for Free Pascal. We
should start working on it in a few months.

-- 
Felipe Monteiro de Carvalho



More information about the Lazarus mailing list