[Lazarus] PDF generator, try 2

Michael Van Canneyt michael at freepascal.org
Thu Mar 31 22:58:07 CEST 2016

On Thu, 31 Mar 2016, Ondrej Pokorny wrote:

> On 31.03.2016 20:39, Michael Van Canneyt wrote:
>> On Thu, 31 Mar 2016, Ondrej Pokorny wrote:
>>> A quick question (sorry I haven't tested): is word breaking supported and 
>>> is it possible to get the target rect of multiline and singleline text?
>> It is possible to get a target rect of a single line; unit fpttf:
>> function TextWidth(AStr: string; APointSize: single): single;
>> Word breaking is left to the calling application.
>> A reporting tool is in the make (well, made, but not released yet)
>> which will handle this.
> Great, thank you!
> And is it possible the other way round? I.e. I know the target rect and I 
> have to export a single line exactly into that rect? (The text has to be 
> scaled to fill the rect.)

I suspect this can be easily implemented.

> Why I ask: I need to print my PDFs directly from a Lazarus application. I 
> have to render the page on a canvas (monitor for preview, printer for 
> printing) and create a PDF from the same source. All three targets (monitor, 
> printer, PDF) have to be exactly equal.
> I achieved this in Delphi with Synopse PDF. Now I'd like to port my reporting 
> solution to Lazarus.

Synopse pdf is the reason I started fppdf. Synopse is heavily Windows
centric, but otherwise quite capable.

Fppdf is a young library (although it required many months of work)
I am sure many improvements will be made as the reporting library develops.

A canvas descendant that renders to pdf is planned, but not very high

Patches and suggestions are definitely welcome. The library is intended for
production, so quality is important.


More information about the Lazarus mailing list