[Lazarus] Tip for Print Preview

Edilson Vieira vieira.edilson at gmail.com
Wed Oct 30 12:56:18 CET 2013


Hi there!

I have just written a generic printing routine to print selected lines of a
dbgrid using a default layout to use in my apps where a specific layout is
not needed. For that I use the TPrinter object.

My objective is to port a big app in Delphi to Lazarus but it has many
QuickReports so I am replacing such code with this routine where the layout
is not an issue.

I am attaching the full source code in a text file (PrintLib.pas, 530 loc)
in case it is useful to someone.

To use it just call the procedure bellow:

procedure PrintSelected(aTitle: string; aDBGrid: TDBGrid; aLogoImage:
TImage);

The Title is a string to be printed on left top corner of each page.
The DBGrid is assumed to have Multiselect in Options, all selected lines
will be printed.
The TImage is for a logo or something alike and is printed on right top
corner of each page.

I am not using LazReport yet because I need the app running in Delphi for a
while. I plan to use it for the more complex reports.

I just have a question if someone could give me a hint on how to make a
form preview of such printing that could be easyly ported to Lazarus.

Wich object shoud I use for this purpose?

Please ignore this message if it is off-topic.

Thanks in advance.

[]'s,

Ed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20131030/c00e3678/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PrintLib.pas
Type: application/octet-stream
Size: 16019 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20131030/c00e3678/attachment-0002.obj>


More information about the Lazarus mailing list