Print Preview Components 5.93

Copyright © Kambiz R. Khojasteh. All rights reserved.
Get future component updates from



The print preview components consist of three visual components for low level print and print preview:

All the print preview components are fully customizable, and offer extensive set of events.


Add the following component's unit into a new or existing package:

The following packages must be added to the requires clause of your package:

Consider that Preview.pas and DELPHIAREA.INC must be in the search path of Delphi.


TPrintPreview is a descendent of TScrollBox and has properties of both TScrollBox component and TPrinter class.

The key features of the TPrintPreview component are:

PrintPreview ComponentKEY PROPERTIES

PrintPreview ComponentKEY METHODS

PrintPreview ComponentKEY EVENTS

PrintPreview ComponentKEYBOARD SHURTCUTS


PrintPreview ComponentPDF OUTPUT

To save preview pages in PDF format, you should have either dsPDF library or Synopse PDF library

dsPDF Library

You can find dsPDF library at, under freeware components section.

Please consider that dsPdf is postcardware, and demo version displays message "This is demo". If you want to get the library without the demo message, you must send the author (Grega Loboda) a postcard of the town or city you live via (snail) mail.

Note: The demo version of dsPdf library does not save document properties (Producer, Author, Creator, Subject, and Title of the document).

Synopse PDF Library

You can download Synopse PDF library from, and it is freeware.

After obtaining Synopse PDF library, open the Preview.pas file and define the SYNOPSE compiler directive in the begining of the file.

Note: Synopse PDF library is still in development stage, and may fail to generate PDF for some sort of contents.


As default, TPrintPreview does not allow image transparency because transparency on printers is not guaranteed. As a work around, you can combine images as needed, and then draw the final image to the printer.

However, if you need image transparency and you think that all target printers of your application will support SrcErase, srcAnd, and SrcInvert raster operations, you can set AllowTransparentDIB global variable to True, so that the control takes care of transparent images.


There are some third party rich edit controls that are not derived from TCustomRichEdit class (e.g. TRxRichEdit control of RxLibrary). In other hand, PaintRichText and GetRichTextRect methods of the TPrintPreview component expect a TCustomRichEdit as their RichEdit parameter.

To workaround this problem and pass such kind of controls to PaintRichText or GetRichTextRect methods, safely type cast the control to TCustomRichEdit. The TPrintPreview component needs only Handle property of rich edit controls for sending Windows messages to them.

Actually, in this way you can print any control that supports EM_GETTEXTLENGTHEX and EM_FORMATRANGE messages.

PrintPreview ComponentKNOWN ISSUES


The TThumbnailPreview control is a special ListView for showing thumbnails of pages generated by TPrintPreview control.

Not only you can use this control to show thumbnail of pages, but also the users can get benefit of it to do some actions (e.g. delete, print, reorder, ...) on the selected pages.

ThumbnailPreview ComponentKEY PROPERTIES

ThumbnailPreview ComponentKEYKEY METHODS

ThumbnailPreview ComponentKEYKEY EVENTS


The TPaperPreview control represents a sheet of paper in the TPrintPreview control, but you can use it as standalone too.

Usage of the TPaperPreview control is very similar to TPainBox control of Delphi. However, in opposite of TPainBox, the TPaperPreview control only repaints the invalidated area and caches the last paint and do not generate redundant OnPaint events. Because of that, when you need to repaint its content, you have to explicitly call one of Invalidate or Repaint methods.

The TPaperPreview control also can be captioned. In this case the caption appears under the page.

PaperPreview ComponentKEYKEY PROPERTIES

PaperPreview ComponentKEY METHODS

PaperPreview ComponentKEY EVENTS





Special thanks to:


The Print Preview components (TPrintPreview, TThumbnailPreview, and TPaperPreview) are freeware. You may copy components' files AS LONG AS YOU COPY ALL OF THEM. If you want to change the source code in order to improve the components' features, performance, etc. please send me the new source code so that I can have a look at it. The changed source code should contain descriptions what you have changed, and of course your name. The only thing you MAY NOT CHANGE is the ORIGINAL COPYRIGHT INFORMATION.


The Print Preview components (TPrintPreview, TThumbnailPreview, and TPaperPreview) are provided "AS IS" without any warranty of any kind, either express or implied. The entire risk as to the quality and performance of the software is with you. The author is NOT liable for any DAMAGES resulting from the use and misuse of the components, especially he is NOT liable for DAMAGES that were caused BY ANY VERSION WHICH HAS NOT BEEN PROGRAMMED BY THE AUTHOR HIMSELF.