Print Preview Components 5.93

Copyright © Kambiz R. Khojasteh. All rights reserved.
Get future component updates from http://www.delphiarea.com.

- Delphi 3
- Delphi 4
- Delphi 5
- Delphi 6
- Delphi 7
- Delphi 2005
- Delphi 2006
- Delphi 2007
- Delphi 2009
- Delphi 2010
- Delphi XE
- Delphi XE2

### CONTENT

### OVERVIEW

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

- TPrintPreview
  This component acts as a printer replacement to generate pages, and then display and manage them.
- TThumbnailPreview
  This component shows pages of TPrintPreview component as thumbnails.
- TPaperPreview
  This component represents a sheet of paper that can be filled by a custom event handler.

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

### INSTALLATION

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

- Preview.pas

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

- VCL
- RTL (for Delphi 6 or higher only)
- DesignIDE (for design-time package of Delphi 6 or higher only)

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

### PRINT PREVIEW COMPONENT

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

The key features of the TPrintPreview component are:

- Supports almost unlimited amount of pages
- Automatically adjusts printer's paper size and orientation at the print time
- Automatically adjusts mapping modes
- Preview pages can be scaled with an arbitrarily zoom factor
- Shows created pages while new pages are being processed
- Displayed pages can be scrolled by mouse dragging
- Pages can be saved/restored to/from disk
- Each page is accessible as a Windows Metafile image
- Has some methods for rendering rich text format
- Can manage custom forms (custom paper sizes)
- Allows background and annotation for both print and preview pages
- Both preview and print pages can be converted to grayscale, and you can adjust brightness and contrast of them
- Allows inserting, replacing, editing, deleting, and reordering of pages freely at any time
- By using dsPDF library or Synopse PDF library, can save pages as PDF
- Can save pages as Multi-Page TIFF.
- Has a complete set of events

> #### PrintPreview ComponentKEY PROPERTIES

> - Annotation: Boolean
>   Indicates whether the annotation drawing is active.
> - Background: Boolean
>   Indicates whether the background drawing is active.
> - CacheSize: Integer
>   Determines the maximum number of pages that the control can keep in memory.
> - CanScrollHorz (Read-only)
>   Indicates whether the preview page can scroll horizontally.
> - CanScrollVert (Read-only)
>   Indicates whether the preview page can scroll vertically.
> - Canvas: TCanvas (Read-only)
>   Provides access to a drawing surface that represents the page. Each page has its own canvas and any access to this property must be inside BeginDoc/EndDoc, BeginEdit/EndEdit, BeginReplace/EndReplace, BeginInsert/EndInsert, and BeginAppend/EndAppend blocks.
> - CanvasPageNo: Integer (Read-only)
>   Indicates the page number that Canvas belongs to it. When control's canvas is not a page canvas, value of CanvasPageNo is zero.
> - CurrentPage: Integer
>   Determines the current showing page number.
> - DirectPrint: Boolean
>   Determines whether the control creates preview pages or directly prints the pages on the printer.
> - Grayscale: TGrayscaleOptions
>   TGrayscaleOptions = set of TGrayscaleOption
>   TGrayscaleOption = (gsPreview, gsPrint)
>   Indicates whether the preview and/or print pages should be converted to grayscale.

>   > gsPreview |  | Shows preview pages in grayscale. However, Background and Anonation items keep their original colors.
>   > gsPrint |  | Print pages in grayscale.

> - GrayBrightness: -100..100
>   Determines brightness of pages in grayscale mode.
> - GrayContrast: -100..100
>   Determines contrast of pages in grayscale mode.
> - IsDummyFormName: Boolean (Read-only)
>   Indicates whether the FormName property reperesents the printer's form name, or a dummy name generated by the control.
> - IsPaperCustom: Boolean (Read-only)
>   Indicates whether a custom paper is in use.
> - IsPaperRotated: Boolean (Read-only)
>   Indicates whether the paper's orientation is landscape.
> - Font: TFont
>   Specifies the default font for each new page. It is reommended to use a scalable font (e.g. TrueType and OpenType).
> - FormName: String
>   Determines the name of selected form for the paper size.
> - Orientation: TPrinterOrientation
>   TPrinterOrientation = (poPortrait, poLanscape)
>   Determines the the paper orientation of pages that will be created. The paper orientation could not change inside the BeginDoc and EndDoc block.
> - PDFDocumentInfo: TPDFDocumentInfo
>   Specifies Producer, Author, Creator, Subjet, and Title of the output PDF file (See SaveAsPDF method and PDF Output for details).
> - Pages[PageNo: Integer]: TMetaFile (Read-only)
>   Contains the list of prepared pages.
> - PageBounds: TRect (Read-only)
>   Specifies the bounding rectangle of the page in logical coordinates.
> - PageSize: TPoint (Read-only)
>   Specifies the paper size in logical coordinates.
> - PageDevicePixels: TPoint (Read-only)
>   Specifies the paper size in device coordinates (pixels).
> - PageLogicalPixels: TPoint (Read-only)
>   Specifies the paper size in screen coordinates (pixels).
> - PaperType: TPaperType
>   Specifies the paper size by the paper's type. There are 68 predefined sizes however by setting this property to pCustom you can use PaperWidth and PaperHeight properties to set your own custom paper size.
> - PaperHeight: Integer
>   Determines the physical height of the paper in logical units. Changing this property will change PaperType to pCustom. The value of PaperHeight must be between 1 and 32767.
> - PaperWidth: Integer
>   Determines the physical width of the paper in logical units. Changing this property will change PaperType to pCustom. The value of PaperWidth must be between 1 and 32767.
> - PaperView: TPaperPreviewOptions
>   Contains display parameters of the visible preview page (see PaperPreview Component for details).
> - PaperViewControl: TPaperPreview
>   Provides access to the control that displays a page (see PaperPreview Component for details).
> - PrintableAreaColor: Color
>   Determines the color to mark printer's printable area.
> - Printer: TPrinter (Read-only)
>   Returns a global instance of TPrinter to manage interaction with the printer.
> - PrinterInstalled: Boolean (Read-only)
>   Indicates whether is there any installed printer (driver) on the system.
> - PrinterPageBounds: TRect (Read-only)
>   Specifies the bounding rectangle of the printer's printable area in logical coordinates.
> - PrintJobTitle: String
>   Specifies the title of the print job on the system's print queue.
> - ShowPrintableArea: Boolean
>   When is True, shows bounding rectangle of printer's printable area on the preview.
> - State: TPreviewState (Read-only)
>   TPreviewState = (psReady, psCreating, psPrinting, psEditing, psLoading, psSaving, psSavingPDF, psSavingTIF)
>   Determines the current state of the control.

>   > psReady |  | The control is idle.
>   > psCreating |  | The BeginDoc method is called and the control is preparing the preview pages to display.
>   > psPrinting |  | One of the print methods is called and the control is printing pages on the printer.
>   > psEditing |  | The BeginEdit method is called and control is editing a page.
>   > psReplacing |  | The BeginReplace method is called and control is replacing a page with a new one.
>   > psInserting |  | Either BeginInsert or BeginAppend method is called and control is inserting/appending a new page.
>   > psLoading |  | The control is loading pages form a stream or file.
>   > psSaving |  | The control is saving pages to a stream or file.
>   > psSavingPDF |  | The control is saving pages as a PDF file.
>   > psSavingTIF |  | The control is saving pages as a multi-page TIFF image.

> - SystemDefaultUnits: TUnits (Read-only)
>   Specifies the default measurement unit of the system. This unit is either mmHiMetric or mmHiEnglish.
> - TotalPages: Integer (Read-only)
>   Determines the total number of available pages to preview/print.
> - Units: TUnits
>   TUnits = (mmPixel, mmLoMetric, mmHiMetric, mmLoEnglish, mmHiEnglish, mmTWIPS, mmPoints)
>   Determines how the control interprets the measurement values (e.g. paper size, margins, font height, pen width, coordinates, and so on).

>   > mmPixel |  | 1 unit = 1 pixel
>   > mmLoMetric |  | 1 unit = 0.1 millimeter
>   > mmHiMetric |  | 1 unit = 0.01 millimeter
>   > mmLoEnglish |  | 1 unit = 0.01 inch
>   > mmHiEnglish |  | 1 unit = 0.001 inch
>   > mmTWIPS |  | 1 unit = 1 twip = 1/20 point = 1/1440 inch
>   > mmPoints |  | 1 unit = 1 point = 1/72 inch

> - UsePrinterOptions: Boolean
>   Specifies where the control looks for page information. When UseUserPage is true, the control uses the printer's paper size and orientation to for the paper size, otherwise it uses the paper size and orientation set in the control.
> - Zoom: Integer
>   Specifies how much the control scales pages on the screen. Changing this property will change ZoomState to zsZoomOther.
> - ZoomState: TZoomState
>   TZoomState = (zsZoomOther, zsZoomToWidth, zsZoomToHeight, zsZoomToFit)
>   Determines how the control scales pages on the screen.

>   > zsZoomOther |  | Scaling factor determines by Zoom property.
>   > zsZoomToWidth |  | Whole the page's width will be visible.
>   > zsZoomToHeight |  | Whole the page's height will be visible.
>   > zsZoomToFit |  | Whole the page will be visible.

> - UserDefaultUnits: TUnits (Read-only)
>   Specifies the prefered measurement unit of the user. This unit is either mmHiMetric or mmHiEnglish.
> - ZoomSavePos: Boolean
>   Indicates whether the control keeps the old scroll positions when the zoom is changing.
> - ZoomStep: Integer
>   Determines the amount of changes in zoom percentage when it increments or decrements by a keyboard shurtcut or mouse wheel movement.
> - ZoomMin: Integer
>   Determines the minimum allowed value for the Zoom property.
> - ZoomMax: Integer
>   Determines the maximum allowed value for the Zoom property.

> #### PrintPreview ComponentKEY METHODS

> - procedure BeginDoc
>   Initiates a new job and creates the Canvas.
> - procedure EndDoc
>   Finalizes the current job.
> - procedure NewPage
>   Starts a new page.
> - function BeginEdit(PageNo: Integer): Boolean
>   Intializes Canvas to edit the page specified by the PageNo parameter.
> - procedure EndEdit(Cancel: Boolean)
>   Finalizes editing the page. When Cancel parameter is True, the modification is ignored.
> - function BeginReplace(PageNo: Integer): Boolean
>   Intializes Canvas to replace the page specified by the PageNo parameter with a new one.
>   Calling this method raises the OnNewPage event.
> - procedure EndReplace
>   Finalizes replacing the page. When Cancel parameter is True, the modification is ignored.
> - function BeginInsert(PageNo: Integer): Boolean
>   Intializes Canvas to insert a new page before the page specified by the PageNo parameter. To insert the new page as the last page, pass a value large than TotalPages property as PageNo parameter.
>   Calling this method raises the OnNewPage event.
> - procedure EndInsert
>   Finalizes inserting the new page. When Cancel parameter is True, the modification is ignored.
> - function BeginAppend: Boolean
>   Intializes Canvas to insert a new page at the end of pages.
>   Calling this method raises the OnNewPage event.
> - procedure EndAppend
>   Finalizes appending the new page. When Cancel parameter is True, the modification is ignored.
> - function Delete(PageNo: Integer): Boolean
>   Removes the specified page.
> - function Exchange(PageNo1, PageNo2: Integer): Boolean
>   Swaps content of the specified pages.
> - function Move(PageNo, NewPageNo: Integer): Boolean
>   Changes position of the specified page to the new location.
> - procedure Clear
>   Clears all pages and resets the control.
> - procedure Print
>   Sends all pages to the printer.
> - procedure PrintPages(FromPage, ToPage: Integer)
>   Sends the selected range of pages to the printer.
> - procedure PrintPagesEx(Pages: TIntegerList)
>   Sends the selected pages to the printer.
> - procedure LoadFromStream(Stream: TStream)
>   Loads pages from a stream.
> - procedure SaveToStream(Stream: TStream)
>   Saves pages into a stream.
> - procedure LoadFromFile(const FileName: String)
>   Loads pages from a previously saved file.
> - procedure SaveToFile(const Filename: String)
>   Saves pages into a file.
> - procedure SaveAsTIF(const Filename: String)
>   Saves pages as a multi-frame TIFF image.
> - function CanSaveAsTIF: Boolean
>   Returns True if GDI+ is enabled to save pages as a multi-frame TIFF image.
> - procedure SaveAsPDF(const Filename: String)
>   Saves pages as a PDF file.
> - function CanSaveAsPDF: Boolean
>   Returns True if PDF writer module is installed.
> - procedure UpdateAnnotation
>   Forces the control to redraw the current page's annotation and update the screen.
> - procedure UpdateBackground
>   Forces the control to redraw the current page's background and update the screen.
> - procedure UpdateZoom
>   Forces the control to recalculate zoom scale and update the screen.
> - procedure ConvertPoints(var Points; NumPoints: Integer; InUnits, OutUnits: TUnits)
>   Converts the Points' coordinates from the input unit specified by InUnits parameter to the unit specified by the OutUnits.
> - function ConvertXY(X, Y: Inetger; InUnits, OutUnits: TUnits): TPoint
>   Returns the point's coordinate converted from the input unit specified by InUnits parameter to the unit specified by the OutUnits.
> - function ConvertX(X: Integer; InUnits, OutUnits: TUnits): Integer
>   Returns the conversion of a value reperesenting a horizontal offset or size from the input unit specified by InUnits parameter to the unit specified by the OutUnits.
> - function ConvertY(Y: Integer; InUnits, OutUnits: TUnits): Integer
>   Returns the conversion of a value reperesenting a vertical offset or size from the input unit specified by InUnits parameter to the unit specified by the OutUnits.
> - function BoundsFrom(AUnits: TUnits; ALeft, ATop, AWidth, AHeight: Integer): TRect
>   Converts a rectangle specified by its position and size from the specified measurement unit to the preview's units.
> - function RectFrom(AUnits: TUnits; ALeft, ATop, ARight, ABottom: Integer): TRect
>   Converts a rectangle specified by its corner positions from the specified measurement unit to the preview's units.
> - function PointFrom(AUnits: TUnits; X, Y: Integer): TRect
>   Converts a point from the specified measurement unit to preview's unit.
> - function XFrom(AUnits: TUnits; X: Integer): TRect
>   Converts a value reperesenting a horizontal offset or size from the specified measurement unit to preview's unit.
> - function YFrom(AUnits: TUnits; Y: Integer): TRect
>   Converts a value reperesenting a vertical offset or size from the specified measurement unit to preview's unit.
> - function PaintGraphic(X, Y: Integer; Graphic: TGraphic): TPoint
>   Renders the graphic specified by the Graphic parameter on the canvas at the location given by the coordinates (X, Y). The coordinates are in the preview's unit. The function returns the size of the graphic in the preview's unit.
> - function PaintGraphicEx(const Rect: TRect; Graphic: TGraphic; Proporional, ShrinkOnly, Cnter: Boolean): TRect
>   Draws the graphic specified by the Graphic parameter in the rectangle specified by the Rect parameter. The coordinates are in the preview's unit. The function returns the bounding rectangle of the graphic in the preview's unit.
> - function PaintGraphicEx2(const Rect: TRect; Graphic: TGraphic; VertAlign: TVertAlign; HorzAlign: THorzAlign): TRect;
>   Draws the graphic specified by the Graphic parameter in the rectangle specified by the Rect parameter. The coordinates are in the preview's unit. The function returns the bounding rectangle of the graphic in the preview's unit.
> - function PaintWinControl(X, Y: Integer; WinControl: TWinControl): TPoint
>   Renders the windowed control specified by the WinControl parameter on the canvas at the location given by the coordinates (X, Y). The coordinates are in the preview's unit. The function returns the size of the rendered image in the preview's unit.
> - function PaintWinControlEx(const Rect: TRect; WinControl: TWinControl; Proporional, ShrinkOnly, Cnter: Boolean): TRect
>   Draws the windowed control specified by the WinControl parameter in the rectangle specified by the Rect parameter. The coordinates are in the preview's unit. The function returns the bounding rectangle of the graphic in the preview's unit.
> - function PaintWinControlEx2(const Rect: TRect; Graphic: TGraphic; VertAlign: TVertAlign; HorzAlign: THorzAlign): TRect;
>   Draws the windowed control specified by the WinControl parameter in the rectangle specified by the Rect parameter. The coordinates are in the preview's unit. The function returns the bounding rectangle of the graphic in the preview's unit.
> - funtion PaintRichText(const Rect: TRect; RichEdit: TCustomRichEdit; MaxPages: Integer; pOffset: PInteger): Integer
>   Renders the content of the RichEdit control specified by the RichEdit parameter in the rectangle specified by the Rect parameter. The coordinates are in the preview's unit. If the content does not fit to the specified rectangle, the functions draw the rest in a new page. The function returns the number of pages used to render the content. The maximum number of pages allowed to print can be controlled by the MaxPages parameter. When MaxPages is zero, the function prints all the pages. The pOffset parameter is a pointer to an integer containing the offset (zero based) of the text, which rendering begins from that point. When the function does not render all the pages, the variable pointed by pOffset updates to the offset of the next part of the text that should be rendered in the next call, otherwise it sets to -1. The pOffset parameter can be nil. The functions returns the number of pages that are rendered.
> - funtion GetRichTextRect(var Rect: TRect; RichEdit: TCustomRichEdit; pOffset: PInteger): Integer
>   Claulates the smallest bounding rectangle required for rendering one page of the content of the RichEdit control specified by the RichEdit parameter in the rectangle specified by the Rect parameter. The coordinates are in the preview's unit. The pOffset parameter is a pointer to an integer containing the offset (zero based) of the text, which rendering begins from that point. When the content of the rich edit does not fit into the specified rectangle, the variable pointed by pOffset updates to the offset of the next part of the text that, otherwise it sets to -1. The pOffset parameter can be nil. The functions returns the number of bottom of the bounding rectangle..
> - procedure GetPrinterOptions
>   Gets the paper size and orientation of the control from the currently selected printer's paper and orientation. When the UsePrinterOptions property is True, after calling the BeginDoc method, the control automatically gets the paper size and paper orientation from the current printer.
> - procedure SetPrinterOptions
>   Sets the paper and orientation of the currently selected printer to paper size and orientation of the control. When the UsePrinterOptions property is False, the control automatically calls this method before beginning to print.
> - procedure SetPageSetupParameters(PageSetupDialog: TPageSetupDialog) (Delphi 7 and later only)
>   Sets the paper size and orientation of the page setup dialog to the control's paper size and orientation.
> - function GetPageSetupParameters(PageSetupDialog: TPageSetupDialog): TRect (Delphi 7 and later only)
>   Gets the paper size and orientation from the page setup dialog. This function returns the bounding rectangle of the page after applying margins specified by the page setup dialog.
> - function ScreenToPreview(X, Y: Integer): TPoint
>   Translates a given point in pixels from the screen resolution to the preview's unit.
> - function PreviewToScreen(X, Y: Integer): TPoint
>   Translates a given point in preview's unit to pixels in screen resolution.
> - function ScreenToPaper(const Pt: TPoint): TPoint
>   Translates a given point from screen coordinates to the paper coordinates. The paper coordinates are in the currently selected measurement unit.
> - function PaperToScreen(const Pt: TPoint): TPoint
>   Translates a given point from the paper coordinates to screen coordinates. The paper coordinates are in the currently selected measurement unit.
> - function ClientToPaper(const Pt: TPoint): TPoint
>   Translates a given point from client area coordinates to the paper coordinates. The paper coordinates are in the currently selected measurement unit.
> - function PaperToClient(const Pt: TPoint): TPoint
>   Translates a given point from the paper coordinates to the client area coordinates. The paper coordinates are in the currently selected measurement unit.
> - function FetchFormNames(FormNames: TStrings): Boolean
>   Fills the specified list with the name of available (predefined and custom) forms in the system.
> - function GetFormSize(const AFormName: String; out FormWidth, FormHeight: Integer): Boolean
>   Gets width and height of the specified form in the selected measurement unit.
> - function AddNewForm(const AFormName: String; FormWidth, FormHeight): Boolean;
>   Adds a custom form to the system. The form's size should be expressed in the selected measurement unit. The user must have full rights to the printer driver to call this function.
> - function RemoveForm(const AFormName: String): Boolean
>   Removes a custom form. This function does not delete the standard forms that the operating system defines. The user must have full rights to the printer driver to call this function.
> - procedure DrawPage(PageNo: Integer; Canvas: TCanvas; const Rect: TRect; Gray: Boolean)
>   Draws a preview page specified by its page number on the specified canvas and bouding rectangle.

> #### PrintPreview ComponentKEY EVENTS

> - OnAnnotation: TPreviewPageDrawEvent
>   TPreviewPageDrawEvent = procedure(Sender: TObject; PageNo: Integer; Canvas: TCanvas) of object
>   If Annotation proprty set to True, occurs after a page is displayed. The items drawn on the provided canvas will appear over the preview page, but do not appear on print.
> - OnBackground: TPreviewPageDrawEvent
>   TPreviewPageDrawEvent = procedure(Sender: TObject; PageNo: Integer; Canvas: TCanvas) of object
>   If Background proprty set to True, occurs just before a page being displayed. The items drawn on the provided canvas will appear under the preview page, but do not appear on print.
> - OnBeginDoc: TNotifyEvent
>   Occurs when BeginDoc method calls.
> - OnEndDoc: TNotifyEvent
>   Occurs when EndDoc method calls.
> - OnNewPage: TNotifyEvent
>   Occurs immediately after a new page is created.
> - OnEndPage: TNotifyEvent
>   Occurs when a page is finished.
> - OnChange: TNotifyEvent
>   Occurs when the current page or content of the control changes.
> - OnStateChange: TNotifyEvent
>   Occurs when value of State property changes.
> - OnZoomChange: TNotifyEvent
>   Occurs when the zoom ratio of the view is changed.
> - OnPaperChange: TNotifyEvent
>   Occurs when size of orientation of paper changed.
> - OnBeforePrint: TNotifyEvent
>   Occurs just before sending pages to the printer.
> - OnAfterPrint: TNotifyEvent
>   Occurs when printing process is finished.
> - OnProgress: TPreviewProgressEvent
>   TPreviewProgressEvent = procedure(Sender: TObject; Done, Total: Integer) of object
>   Occurs periodically during the print and save as PDF and TIFF operations. You can check the value of State property to determine which operation is generating this event.
> - OnPageProcessing: TPreviewPageProcessingEvent
>   TPreviewPageProcessingEvent = procedure(Sender: TObject; PageNo: Integer; var Choice: TPageProcessingChoice) of object
>   TPageProcessingChoice = (pcAccept, pcIgnore, pcCancellAll)
>   Occurs during the print and save as PDF and TIFF operations, just before processing a page. You can check the value of State property to determine which operation is generating this event.
>   The Choice parameter can be set to one of the following values:

>   > pcAccept (default) |  | The operation will process the page.
>   > pcIgnore |  | The operation will ignore this page.
>   > pcCancellAll |  | The whole operation will be cancelled.

> - OnPrintAnnotation: TPreviewPageDrawEvent
>   TPreviewPageDrawEvent = procedure(Sender: TObject; PageNo: Integer; Canvas: TCanvas) of object
>   If Annotation proprty set to True, occurs after a page is printed. The items drawn on the provided canvas will place over the printed page.
> - OnPrintBackground: TPreviewPageDrawEvent
>   TPreviewPageDrawEvent = procedure(Sender: TObject; PageNo: Integer; Canvas: TCanvas) of object
>   If Background proprty set to True, occurs just before a page being printed. The items drawn on the provided canvas will place under the printed page.

> #### PrintPreview ComponentKEYBOARD SHURTCUTS

> - Home
>   Scrolls the current page to the left most position.
> - Ctrl+Home
>   Scrolls the current page to the top most position.
> - End
>   Scrolls the current page to the right most position.
> - Ctrl+End
>   Scrolls the current page to the bottom most position.
> - Left
>   Scrolls the current page to the right with the number of pixels specified in HorzScrollbar.Increment property.
> - Shift+Left
>   Scrolls the current page one pixel to the right.
> - Ctrl+Left
>   Scrolls the current page one screen to the right.
> - Right
>   Scrolls the current page to the left with the number of pixels specified in HorzScrollbar.Increment property.
> - Shift+Right
>   Scrolls the current page one pixel to the left.
> - Ctrl+Right
>   Scrolls the current page one screen to the left.
> - Up
>   Scrolls the current page down with the number of pixels specified in VertScrollbar.Increment property.
> - Shift+Up
>   Scrolls the current page one pixel down.
> - Ctrl+Up
>   Scrolls the current page one screen down.
> - Down
>   Scrolls the current page up with the number of pixels specified in VertScrollbar.Increment property.
> - Shift+Down
>   Scrolls the current page one pixel up.
> - Ctrl+Down
>   Scrolls the current page one screen up.
> - Page Up
>   Shows the previous page.
> - Ctrl+Page Up
>   Shows the first page.
> - Page Down
>   Shows the next page.
> - Ctrl+Page Down
>   Shows the last page.
> - Plus (Numeric Pad)
>   Zoom in by the amount specified in the ZoomStep property.
> - Minus (Numeric Pad)
>   Zoom out by the amount specified in the ZoomStep property.

> #### PrintPreview ComponentMOUSE WHEEL FUNCTIONS

> - Wheel Down
>   Scrolls the current page up with the number of pixels specified in VertScrollbar.Increment property.
> - Wheel Up
>   Scrolls the current page down with the number of pixels specified in VertScrollbar.Increment property.
> - Ctrl+Wheel Down
>   Zoom out by the amount specified in the ZoomStep property.
> - Ctrl+Wheel Up
>   Zoom in by the amount specified in the ZoomStep property.
> - Shift+Wheel Down | Wheel Press + Wheel Down
>   Shows the next page.
> - Shift+Wheel Up | Wheel Press + Wheel Up
>   Shows the previous page.

> #### 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 http://delphistep.cis.si, 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 http://www.synopse.info, 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.

> #### IMAGE TRANSPARENCY

> 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.

> #### PrintPreview ComponentTHIRD PARTY RICH EDIT CONTROLS

> 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

> - If Units property is set to mmHiMetric and width or height of the paper size is bigger than 32767 units, the page will not display correctly. This happens because SetWindowExtEx API function expects a two bytes signed integer (Smallint) as its X and Y parameters, so values bigger than 32767 are interpreted as negative values.
> - When the zoom is not on the actual size (100%), the control may display the preview of the scalable fonts inproperly. Always use TrueType or OpenType fonts in your print.
> - The PaintRichText and GetRichTextRect methods use EM_FORMATRANGE message of the rich edit control. This message has different behavior on different versions of the rich edit control. In addition, this message ignores the embedded objects in the RTF text.
> - The preview of a rich text may differ from its printed version. This issue is a known rich edit control problem. To print RTF text, it is recommended to set DirectPrint property to True and regenerate the pages.
> - After editing a page (e.g. calling BeginEdit method) for several times, you see this action gets slower each time. Editing page involves merging two Windows metafiles, adding new content to the old page. Windows API has problem on merging metafiles, and I cannot do anything about it. If you need to edit a page more than 10 times, it's better to create a new page and replace it with the old one (e.g. calling BeginReplace method).

### THUMBNAIL PREVIEW COMPONENT

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

> - AllowReorder: Boolean
>   When set to true, user can reorder pages using drag and drop opration.
> - DisableTheme: Boolean
>   Specifies whether the control should bypass Windows theme or not.
> - DropTarget: Integer (Read-only)
>   Specifies the number of page that is target of drag operation.
> - Grayscale: TThumbnailGrayscale
>   TThumbnailGrayscale = (tgsPreview, tgsNever, tgsAlways)
>   Determines whether the thumbnails should be displayed in grayscale.

>   > tgsPreview |  | The value of Grayscale property of the attached TPrintPreview control determines whether the thumbnails are in grayscale ro not.
>   > tgsNever |  | Regardless of the value of Grayscale property of the attached TPrintPreview control, the thumbnails never display in grayscale.
>   > tgsAlways |  | Regardless of the value of Grayscale property of the attached TPrintPreview control, the thumbnails always display in grayscale.

> - IsGrayscaled (Read-only)
>   Indicates whether the thumbnails are currently grayscaled.
> - MarkerColor: TColor
>   Determines the border color around the thumbnail page which is the current page on the PrintPreview control.
> - PrintPreview: TPrintPreview
>   Determines the PrintPreview control that feeds pages to the control.
> - Selected: Integer
>   Specifies the number of page that is selected. In a multiselect scenario, this is the first selected page.
> - SpacingHorizontal: Integer
>   Specifies the horizontal space (in pixels) between two thumbnails.
> - SpacingVertical: Integer
>   Specifies the vertical space (in pixels) between two thumbnails.
> - Zoom: Integer
>   Specifies the relative size of each thumbnail to its actual page size in percent.

> #### ThumbnailPreview ComponentKEYKEY METHODS

> - function PageAt(X, Y: Integer): Integer
>   Returns the page number of thumbnail at the specified location of the control's client area or zero if no thumbnail found.
> - procedure PageAtCursor
>   Returns the page number of thumbnail under the mouse cursor or zero if no thumbnail found.
> - procedure GetSelectedPages(Pages: TIntegerList)
>   Fills the list with page number of currently selected thumbnails.
> - procedure SetSelectedPages(Pages: TIntegerList)
>   Selects the thumbnails with the specified page numbers.
> - procedure DeleteSelectedRemoves the selected pages.
> - procedure PrintSelectedPrint the selected pages.

> #### ThumbnailPreview ComponentKEYKEY EVENTS

> - OnPageBeforeDraw: TPageThumbnailDrawEvent
>   TPageThumbnailDrawEvent = procedure(Sender: TObject; PageNo: Integer; Canvas: TCanvas; const Rect: TRect; var DefaultDraw: Boolean) of object
>   Occurs before a thumbnail beging drawn.
> - OnPageAfterDraw: TPageThumbnailDrawEvent
>   TPageThumbnailDrawEvent = procedure(Sender: TObject; PageNo: Integer; Canvas: TCanvas; const Rect: TRect; var DefaultDraw: Boolean) of object
>   Occurs after a thumbnail is drawn.
> - OnPageClick: TPageNotifyEvent
>   TPageNotifyEvent = procedure(Sender: TObject; PageNo: Integer) of object
>   Occurs when the user clicks a thumbnail.
> - OnPageDblClick: TPageNotifyEvent
>   TPageNotifyEvent = procedure(Sender: TObject; PageNo: Integer) of object
>   Occurs when the user double clicks a thumbnail.
> - OnPageInfoTip: TPageInfoTipEvent
>   TPageInfoTipEvent = procedure(Sender: TObject; PageNo: Integer; var InfoTip: String) of object
>   Occurs when the mouse pointer moves over a thumbnail that can display an InfoTip text.
> - OnPageSelect: TPageNotifyEvent
>   TPageNotifyEvent = procedure(Sender: TObject; PageNo: Integer) of object
>   Occurs when a page selected.
> - OnPageUnselect: TPageNotifyEvent
>   TPageNotifyEvent = procedure(Sender: TObject; PageNo: Integer) of object
>   Occurs when a selected page deselects.

### PAPER PREVIEW COMPONENT

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

> - Alignment: TAlignment
>   Controls the horizontal placement of the caption.
> - BorderColor: TColor
>   Determines the color of border around the pager.
> - BorderWidth: TBorderWidth
>   Determines the size of border around the pager.
> - Caption: String
>   Specifies the text that appears under the paper.
> - PageRect: TRect (Read-only)
>   Gets the bounding box of the paper in control's coordinates.
> - PaperWidth: Integer
>   Indicates the value of width (in pixels) of the page.
> - PaperHeight: Integer
>   Indicates the value of height (in pixels) of the page.
> - PaperSize: TPoint
>   Gets and sets width and height (in pixels) of the paper all at once.
> - PreservePaperSize: Boolean
>   When set to True, changes in BorderSize, ShadowSize, Caption, and ShowCaption properties do not alter value of PaperWidth and PaperHeight properties and change control's size. When set to False, the control's size keeps constant but PaperWidth and PaperHeight properties adjust to the available space.
> - ShadowColor: TColor
>   Determines the color of paper's shadow.
> - ShadowWidth: TBorderWidth
>   Determines the size of shadow for the paper.
> - ShowCaption: Boolean
>   Indicates whether the control's caption is visible.

> #### PaperPreview ComponentKEY METHODS

> - function ClientToPaper(const Pt: TPoint): TPoint
>   Translates a point on the client area of the control to its corresponding point on the paper area.
> - function PaperToClient(const Pt: TPoint): TPoint
>   Translates a point on the paper area to its corresponding point on the client area of the control.
> - procedure SetBoundsEx(ALeft, ATop, APaperWidth, APaperHeight: Integer)
>   Sets the Left, Top, PaperWidth, and PaperHeight properties all at once.

> #### PaperPreview ComponentKEY EVENTS

> - OnPaint: TPaperPaintEvent
>   TPaperPaintEvent = procedure(Sender: TObject; Canvas: TCanvas; const Rect: TRect) of object
>   Occurs when the paper needs to be painted.
>   Because the control caches the last paint, you need to call one of Invalidate or Repaint methods to update the paper's content.

### OTHER CLASSES

- class TTemporaryFileStream = class(THandleStream)
  This is an optimal temporary file stream.
- class TIntegerList = class(TList)
  Holds a list of integer values. Also, can save/load the list of values to/from a stream.
- class TMetafileList = class(TObject)
  Holds a list of Metafile images with memory optimization and caching capabilities.

### GLOBAL PROCEDURES

- function ConvertUnits(Value, DPI: Integer; InUnits, OutUnits: TUnits): Integer
  Returns the conversion of the value specified by the Value parameter from the measurement unit specified by the InUnits parameter to the measurement unit specified by the OutUnit parameter. If neither source nor destination units are mmPixel, the DPI parameter will be ignored.
- procedure DrawGraphic(Canvas: TCanvas; X, Y: Integer; Graphic: TGraphic)
  Converts the graphic specified by the Graphic parameter to Device Independent Bitmap (DIB) and draws it at the position specified by the X and Y parameters on the canvas specified by the Canvas parameter. This procedure is useful for printing images on a printer canvas.
- procedure StretchDrawGraphic(Canvas: TCanvas; Rect: TRect; Graphic: TGraphic)
  Converts the graphic specified by the Graphic parameter to Device Independent Bitmap (DIB) and draws it in the rectangle specified by the Rect parameter on the canvas specified by the Canvas parameter. This procedure is useful for printing images on a printer canvas.
- procedure DrawGrayscale(Canvas: TCanvas; X, Y: Integer; Graphic: TGraphic; Brightness: Integer = 0; Contrast: Integer = 0)
  Converts the graphic specified by the Graphic parameter to 256 grayscaled colors Device Independent Bitmap (DIB) and draws it at the position specified by the X and Y parameters on the canvas specified by the Canvas parameter. This procedure is useful for printing images on a printer canvas.
- procedure StretchDrawGrayscale(Canvas: TCanvas; Rect: TRect; Graphic: TGraphic; Brightness: Integer = 0; Contrast: Integer = 0)
  Converts the graphic specified by the Graphic parameter to 256 grayscaled colors Device Independent Bitmap (DIB) and draws it in the rectangle specified by the Rect parameter on the canvas specified by the Canvas parameter. This procedure is useful for printing images on a printer canvas.
- function CreateWinControlImage(WinControl: TWinControl): TGraphic
  Creates a graphic object from the snapshot of the specified windowed control.
- procedure ConvertBitmapToGrayscale(Bitmap: TBitmap; Brightness: Integer = 0; Contrast: Integer = 0)
  Converts colors of the bitmap specified by the Bitmap parameter to 256 grayscaled colors. Optionally, you can adjust brightness and contrast of the grayscaled images with values in range -100 to 100.
- procedure SmoothDraw(Canvas: TCanvas; const Rect: TRect; Metafile: TMetafile)
  Draws the metafaile in the rectangle specified by the Rect parameter on the canvas specified by the Canvas parameter.
- function dsPDF: TdsPDF
  Returns a wrapper object for dsPDF library. This is a singleton object, do not destroy it.
- function gdiPlus: TGDIPlusSubset
  Returns a wrapper object for GDI+ subset. This is a singleton object, do not destroy it.

### HISTORY

- Version 5.93 (March 4, 2018)
  - Addressed the scaling issue on screens with high DPI configuration (Thanks to VPC16).
  - Fixed the broken mouse wheel functionality on Windows 8 and 10.
- Version 5.92 (August 7, 2016)
  - Fixed a momory leak in TThumbnailPreview class (Thanks to MeW).
- Version 5.91 (January 3, 2016)
  - Fixed the temporary file handle leak (Thanks to Florian Grummel).
- Version 5.90 (November 4, 2012)
  - Fixed the image positioning problem in PainGraphic method (Thanks to Ilya).
  - Fixed direct printing of pages with metafile content.
  - Some minor tweaks.
- Version 5.80 (June 18, 2012)
  - Fixed the compatibility issue with Delphi XE2 on 64-bit environment.
- Version 5.70 (June 28, 2011)
  - Fixed the GDI+ shutdown issue (Thanks to mckiss).
  - Fixed the incorrect scrolling direction using mouse wheel (Thanks to Jon L. Bondy).
  - For convenience, added BeginAppend and EndAppend methods for adding a new page at the end of pages.
- Version 5.61 (November 25, 2010)
  - Fixed the GDI+ issue when it is used inside a dll (Thanks to Dmitry).
  - In some cases, resizing TPrintPreview control was not updating the visible area marker of the selected thumbnail.
  - Added DisableTheme property to TThumbnailPreview control. Windows Aero makes the selected thumbnail unclear. By setting this property to true, you can prevent this problem.
- Version 5.60 (October 19, 2010)
  - Added OnPageProcessing event to TPrintPreview control (Thanks to Dr. Dieter Köhler). This event occurs just before processing a page, during the print and save as PDF and TIFF operations. You can use this event to filter pages or cancel the whole operation.
  - Changed the parameter list of OnProgress event. Now this event just reports the progress; neither reports processing page number nor provides a way to cancel the operation.
  - Removed some redundant code (Thanks to Dr. Dieter Köhler).
- Version 5.50 (August 19, 2010)
  - As of now, the TPrintPreview control uses GDI+ for smooth drawing and multi-frame TIFF output without need of any third-party wrapper.
  - The PrintPreview output format has been changed. With the new format you can save/load pages to/from middle of a stream containing other contents. In the other hand, lack of version information was the main problem of the older format, and because of that I couldn't provide a backward compatible output.
  - Ouput compression is no more supported. Because loading and saving routines need random access to the stream and compression/decompression streams provide only sequential access, using ZLib library requires an intermediate stream. This is something that should be done in your own application if it is really needed.
  - Some minor tweaks.
- Version 5.41 (August 13, 2010)
  - Fixed the bug appeared in the previous release, and preventing TPrintPreview control to be placed on a form (Thanks to Guilherme Lepsch).
- Version 5.40 (August 12, 2010)
  - Added PageLogicalPixels property to TPrintPreview control. This property returns size of paper in screen coordinates and in pixels.
  - In TPrintPreview control, renamed PagePixels property to PageDevicePixels. This change is because of introducing the new property PageLogicalPixels.
  - Added ScreenToPreview, PreviewToScreen, ScreenToPaper, and PaperToScreen methods to TPaperPreview control.
  - Added PaintWinControlEx2 method to TPaperPreview control. This method is simlar to PaintGraphicEx2 except that it works on a windowed control.
  - Added OnProgress event to TPrintPreview control. This event occurs during printing and saving pages as PDF and multi-frame TIFF.
  - Removed OnPrintProgress event from TPrintPreview control. The OnProgress event covers this old event.
  - Removed Aborted property, Abort method, and OnAbort event from TPrintPreview control. You can provide an event handler for OnProgress event to cancel printing.
  - In TPaperPreview control, renamed BorderSize and ShadowSize properties to BorderWidth and ShadowWidth. By this change, these properties share the same name with their corresponding properties in TPaperPreviewOptions class.
  - Added ClientToPaper and PaperToClient methods to TPaperPreview control.
  - Added global CreateWinControlImage function. This function returns a graphic object from the screen snapshot of a windowed control.
- Version 5.30 (July 31, 2010)
  - Added support for Synopse PDF library (Thanks to Martijn van der Kooij).
  - Added PaperViewControl property to TPrintPreview control.
  - Added global SmoothDraw function.
  - Added global dsPDF function.
  - Fixed compatibility issue with Delphi 2009 and 2010 (Thanks to Jens Doll).
  - Some optimization tweaks.
- Version 5.20 (May 8, 2010)
  - Fixed a possible memory leak (Thanks to Detlef).
  - Added PDFDcumentInfo property to TPrintPreview control (Thanks to Yannick).
- Version 5.16 (March 7, 2010)
  - Fixed corruption of temporary file.
- Version 5.15 (February 6, 2010)
  - Now UserDefaultUnits and SystemDefaultUnits properties of TPrintPreview return the expected values (Thanks to Johan van Ooijen).
  - The compatibility issue of TThumbnailPreview on Delphi 5 and earlier resolved.
- Version 5.14 (March 2, 2009)
  - The wired bug of TThumbnailPreview on Windows XP fixed.
  - Getting printer's paper size when paper orientation was landscape, could result in wrong paper orientation.
  - Setting paper size via form name was not considering the current paper orientation.
  - Setting paper size when control's width was one pixel had no effect. It was because of misspelling of a variable name and fixed.
- Version 5.13 (February 23, 2009)
  - Fixed compatibility issues with Delphi 5 and earlier.
- Version 5.12 (February 2, 2009)
  - The TPageSetupDialog component is not available in Delphi versions before Delphi 7, therefore the SetPageSetupParameters and GetPageSetupParameters methods of TPrintPreview control should not be available for those versions of Delphi too. Missing this was causing the component could not be installed on Delphi 6 and earlier.
- Version 5.11 (January 22, 2009)
  - The bug that appeared in the last update and caused changes in the Units property do not update the value of PaperWidth/PaperHeight properties, is fixed.
- Version 5.10 (January 14, 2009)
  - If the unit compiles with GDI_PLUS directive, the TPrintPreview component uses GDI+ to draw preview pages and thumbnails. As the result, pages will be displayed smoother.
  - To save pages as a multi-page TIFF image, SaveAsTIF and CanSaveAsTIF methods are added to the TPrintPreview control. The SaveAsTIF method works only when the unit is compiled with GDI_PLUS directive.
  - The psSavingTIF is added as a new TPrintPreview control's state.
  - The Zoom property of TPrintPreview control can accept larger values now. Because of that the default value of ZoomMax property changed from 500 to 1000.
  - To know whether the preview page can be scrolled horizontally or vertically, CanScrollHorz and CanScrollVert properties are added to the TPrintPreview control.
  - As of now, current preview page can be zoomed and scrolled by dragging thumbnail's marker on TThumbnailPreview control.
  - Flickering of TThumbnailPreview control while resizing is fixed.
- Version 5.00 (January 2, 2009)
  - Display rendering for PrintPreview, ThumbnailPreview, and PaperPreview controls are highly optimized.
  - Before this version, the PrintPreview control was keeping only one single page on memory. Now, you can set the number of cached pages using the new CacheSize property.
  - As of now, when there are more pages than cache size, the PrintPreview control uses only a temporary file (very optimum). Because of that UseTempFile property is obselete and has been removed.
  - Besides editing a page, you can now insert new or replace an existing page. Deleting and reordering of pages is also possble. The methods for these actions are BeginReplace, EndReplace, BeginInsert, EndInsert, Delete, Exchange, and Move.
  - To know at each time which page owns the PrentPreview canvas, the new CanvasPageNo property is added.
  - To make conversion of units a bit easier, BoundsFrom, RectFrom, PointFrom, XFrom, and YFrom methods are added.
  - Because for adding a new printer form the user must have the required priviledge on Windows, the control no more automatically add or remove forms. As the result, AutoFormName property and OnAutoCustomForm are obsolete and removed. Instead, use IsDummyFormName property to know the FormName property contains an actual form name or a temporary name.
  - Two new methods for getting/setting properties from/to PageSetupDialog, GetPageSetupParameters and SetPageSeupParametrs are added to PrintPreview control.
  - For getting system and user prefered measurement units SystemDefaultUnits and UserDefaultUnits properties are added to PrintPreview control.
  - To mark printable area of the selected printer on the preview pages, ShowPrintableArea and PrintableAreaColor properties are added to the PrintPreview control.
  - The IsPaperCustom and IsPaperRotated propertis are added to the PrintPreview control. The first one determines whether a custom paper is in use or not, and the other one tells whether the paper orientation is landscape.
  - The preview page on the PrintPreview control can have a hint string different from the control's one.
  - To be able to allow/disallow image transparency for print at runtime, a global boolean variable named AllowTransparentDIB is declared.
  - The OnStateChange event added to the PrintPreview control. This event occurs whenever State property changes. By the way, the control has some new states now.
  - The OnPaperChange event added to the PrintPreview control. This event occurs whenever paper size or orientation changes.
  - Similar to OnBackground and OnAnnotation events, two new events named OnPrintBackground and OnPrintAnnotation are added. Using this events you can draw some other stuffs under or over the hard copied pages.
  - The new method PrintPagesEx added to the PrintPreview control. This method allows you to print unordered and discrete list of pages.
  - To draw a preview page on any canvas, DrawPage method is added to the PrintPreview control.
  - The PaperPreview control can be captioned now. The properties introduced for this purpose are Caption, ShowCaption, Alignment, and WordWrap.
  - The PreservePaperSize property is added to the PaperPreview control. When one of paper parameters (e.g. PaperWidth, PaperHeight, ShadowSize, ...) changes, this property defines which of page or control should be resized.
  - The OnMouseEnter and OnMouseLeave events are added to TPaperPreview control.
  - The ThumbnailPreview control is rewritten from scratch. This version of control is derived from TCustomListView.
  - The Margin and Orientation peroperties of the TThumbnailPreview control are removed. Instead use SpacingHorizontal, SpacingVertical, and IconOptions properties.
  - You can now custom draw thumbnails on the TThumbnailPreview control. The OnPageBeforeDraw and OnPageAfterDraw events are added for these purpose.
  - Now, the thumbnails on TThumbnailPreview control can have a separate popup menu and hint (InfoTip) string.
  - The TThumbnailPreview control is improved by adding OnPageClick, OnPageDblClick, OnPageInfoTip, OnPageSelect, and OnPageUnselect events.
  - The thumbnails in the TThumbnailPreview control can have their Grayscale behavior independent of the attached TPrintPreview control.
  - Because the TThumbnailPreview control is actually a ListView control, you have multiselect option. For example, user can select some pages to print or delete selected pages.
  - The thumbnails in the TThumbnailPreview control can be reordered using drag and drop operations. The new AllowReorder property enables/disables this function.
  - The demo program (general) is updated.
  - Finally, TThumbnailPreview and TPaperPreview controls are documented.
- Version 4.80 (December 2, 2008)
  - Fixed problem of drawing large bitmap images in grayscale (Thanks to EPusch).
  - Added brightness and contrast adjustment in grayscale mode (Thanks to mathgod for the idea).
  - Support for Delphi 2009 added.
- Version 4.77 (December 18, 2007)
  - Fixed problem of calculating size of custom papers (Thanks to e.schmidtlein).
- Version 4.76 (November 20, 2007)
  - Improved printing of windowed control.
- Version 4.75 (May 3, 2007)
  - Fixed a bug in Abort method (Thanks to John Hodgson).
- Version 4.74 (April 27, 2007)
  - The page size included in saving pages as PDF (Thanks to DwrCymru).
- Version 4.73 (April 24, 2007)
  - The bug in saving landscape pages as PDF is fixed (Thanks to akeix).
- Version 4.72 (April 9, 2007)
  - SaveAsPDF and CanSaveAsPDF methods are added. These new methods need dsPDF library by Grega Loboda to function.
- Version 4.71 (February 5, 2007)
  - For displaying and/or printing pages in grayscale, the Grayscale property is introduced.
- Version 4.70 (February 1, 2007)
  - To be able to draw background for preview pages, Background property, OnBackground event, and UpdateBackground method are added.
  - As of this release, FastPrint property is obsolete.
  - Conditional support for image transparency is added.
  - As of this release, defining custom thumbnail class for thumbnail view is allowed.
- Version 4.64 (February 23, 2006)
  - The inavlid parameter type of BltBitmapAsDIB function where causing range check error, is corrected (Thanks to Miguel Gastelumendi).
- Version 4.63 (January 30, 2006)
  - The calculation of printer's printable area corrected (Thanks to Mixy).
  - Some minor tweaks.
- Version 4.62 (May 12, 2005)
  - Some minor tweaks.
- Version 4.61 (February 21, 2005)
  - A minor bug in thumbnail viewer fixed (Thanks to MeW).
- Version 4.60 (July 28, 2004)
  - The Annotaton property, UpdateAnnotation method, and OnAnnotation event added to the TPrintPreview interface.
  - The new property PrinterPageBounds added. This property determines the printable bouding rectangle of the currently selected printer.
- Version 4.53 (June 30, 2004)
  - The bug of setting paper orientation on Windows NT is fixed.
- Version 4.52 (June 25, 2004)
  - Now, when a custom page size is set in the control, the control automatically adds it to the system. Consequently, the AutoFormName property and OnAutoCustomForm event are added.
  - A possible bug on custom page sizes on Windows 98 fixed.
- Version 4.50 (June 19, 2004)
  - The new property FormName, and the new methods FetchFormNames, GetFormSize, AddNewForm, and RemoveForm added to TPrintPreview component.
  - Now, the StretchDrawGraphicAsDIB procedure doesn't convert metafiles to DIB if the metafile doesn't have a DDB record.
  - Some minor tweaks.
- Version 4.40 (May 14, 2004)
  - To make editing of an existing page easier, BeginEdit and EndEdit methods added. Consequently, The new state psEditing added to the list of available control's states.
- Version 4.36 (May 13, 2004)
  - New OnEndPage event added.
- Version 4.35 (April 10, 2004)
  - New method PaintGraphicEx2 added to TPrintPreview component (Thanks to Roy M Klever).
  - The global variable UseHalfTonePrinting added (Thanks to Roy M Klever).
- Version 4.34.1 (March 24, 2004)
  - A bug is fixed (Thanks to Janet Agney).
- Version 4.34 (December 8, 2003)
  - Now, a preview page can be changed just by assigning a metafile to it.
- Version 4.33 (December 6, 2003)
  - Now, the preview pages can be saved as compressed using the ZLib library. As default this feature is disabled.
  - Two new methods ClientToPaper and PaperToClient are added to TPrintPreview component.
  - Now, the preview scrolls faster and smoother.
  - Some minore tweaks.
- Version 4.32 (November 20, 2003)
  - Incorrect printing of the content when the measurement unit was mmPixel, is fixed (Thanks to Bria Dorin).
- Version 4.31 (November 2, 2003)
  - The ConvertUnit, ToPrinterUnit, and Screen2PrinterUnit methods are no longer exist in this release. Instead of the mentioned methods use the new ConvertPoints, ConvertXY, ConvertX and ConvertY methods.
  - For convenience the PageBounds, PageSize, and PagePixels peroperies added.
  - The new property DirectPrint added. To print pages directly on the printer without generating the preview pages, set this property to True.
  - And, some minor tweaks in rendering rich text and drawing preview pages.
- Version 4.30 (October 19, 2003)
  - The bug in printing pages on a printer with different horizontal and vertical resolution fixed.
  - The bug in font size fixed.
  - The points unit added to measurement units.
  - The new component TThumbnailPreview added to the suite. This control shows the thumbnails of TPrintPreview pages.
- Version 4.21 (September 18, 2003)
  - The paper size and paper orientation were missed in the saved preview files, which are added in this release. The old preview files are still readable by the control.
  - Now, the component can be compiled on C++Builder 3 (Thanks to Patrizio Zelotti).
- Version 4.20 (July 27, 2003)
  - The new properties ZoomMin, ZoomMax, and ZoomStep added.
  - The new event OnZoomChange added.
  - The mouse wheel support added.
- Version 4.19 (July 8, 2003)
  - The mistake in interpreting mmLoEnglish and mmHiEnglish units fixed.
- Version 4.18 (July 6, 2003)
  - The bug on zooming the pages fixed (Thanks to Hubert "Johnny_Bit" Kowalski).
  - Now changing the ZoomState property will update the value of the Zoom property.
- Version 4.17 (May 29, 2003)
  - The new method GetRighTextRect added (Thanks to rgesswein).
  - The PaintRichText method modified to support custom RichEdit controls (Thanks to Sebastien).
- Version 4.16 (May 18, 2003)
  - The component modified to use the resolution of the currently selected printer for more accurate print result.
- Version 4.15 (May 3, 2003)
  - Bug in printing windowed controls fixed.
  - The UsePrinterOptions property added.
  - The SetPrinterOptions and GetPrinterOptions methods added.
- Version 4.14 (April 23, 2003)
  - Bug in setting the printer's paper orientation to landscape fixed.
- Version 4.13 (April 16, 2003)
  - Components' icons changed (Thanks to Paul Van Gundy).
  - Now, two different cursor states for scrolling the page by dragging (Thanks to Paul Van Gundy).
- Version 4.12 (April 8, 2003)
  - Bug in printing pages with custom paper size fixed.
- Version 4.11 (March 31, 2003)
  - Bug in rendering images on Windows 2000 and XP fixed (Thanks to Roy M Klever)
- Version 4.10 (March 29, 2003)
  - PaintGraphicEx, PaintWinControlEx, and PaintRichText methos added.
- Version 4.01 (May 11, 2002)
  - A little optimization in SaveToStream and LoadFromStream methods.
- Version 4.00 (January 19, 2002)
  - The control does not support 16bit platform anymore.
  - Peformance and stability of the control on both display and print parts has been improved.
  - SaveToStream and LoadFromStream method added.
  - Memory leak bug fixed.
  - Definition of PaintGraphic and PaintWinControl methods changed.
  - Because of the applied improvements, the following properties are obsolete: MarginLeft, MarginTop, MarginRight, MarginBottom, PageRect, PageWidth, PageHeight, and ZoomOrigion.
- Version 3.20 (January 13, 2002)
  - To improve the control functionality and speed, some internal procedures changed.
  - A value larger than 0.7mm limit for margin properties removed.
- Version 3.10 (January 6, 2002)
  - New property ZeroOrigion added.
- Version 3.01 (April 26, 2001)
  - ZoomSavePos property added to 32bit version of the component (Thanks to Pavel Zidek).
- Older Versions(Unknown Date)
  - Unfortunately, I have missed tracks of the older versions.

### ACKNOWLEDGMENT

Special thanks to:

- Rinaldo Andrea
- Jens Christian Fogtmann
- Damian Tarnawsky
- Bill Miller
- Peter Hedlund
- Pavel Zidek
- Roy M Klever
- Paul Van Gundy
- Hubert "Johnny_Bit" Kowalski
- Tomas Koutny
- Patrizio Zelotti
- Bria Dorin
- Arpad Toth
- Janet Agney
- MeW
- Mixy
- Miguel Gastelumendi
- akeix
- DwrCymru
- John Hodgson
- e.schmidtlein
- EPusch
- mathgod
- Detlef Heibing
- Yannick LANCHEC
- Martijn van der Kooij
- Guilherme Lepsch
- Dr. Dieter Köhler
- Dmitry
- mckiss
- Jon L. Bondy
- Dmitry Muratov
- VPC16

### LICENSE

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.

### DISCLAIMER

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.

| END OF DOCUMENT