srvprint TSRVPrint

Properties   Methods   Events  | Overview

<< Click to display table of contents >>

srvprint TSRVPrint

Properties   Methods   Events  | Overview

TSRVPrint allows printing documents from TSRichViewEdit in several modes, including posters.

Unit SRVPrint.

Syntax

TSRVPrint = class(TComponent)

Hierarchy

TObject

TPersistent

TComponent

Description

The main property of TRVPrint is PrintMode. It defines how the document in SRichViewEdit is printed.

srvpAuto – the printer paper size and orientation are set automatically;

srvpStretchToFit – the current printer paper size and orientation are used;

srvpStretchIfLarger is like srvpStretchToFit if the document page size is larger than the printer paper size. Otherwise, the document is printed at the top left corner of paper.

srvpTiles – if possible, prints several copies of the document page on the same paper sheet;

srvpPoster – allows printing posters: each page can be printed on several paper sheets; this is the most complex mode, it is described below.

srvpGrid – allows printing several document pages on the same paper sheet.

The component uses the current printer (specified in Printer.PrinterIndex, where Printer is a function defined in the Printers unit). When the parameters of the current printer are changed, or the current printer is changed, call Update to recalculate properties according to the printer.

Posters

Sizes

A document is prepared in TSRichViewEdit component . Its size is defined in TSRichViewEdit's page properties.

Each page of this document is scaled to RealWidth x RealHeight (see below how they are calculated).

Each page of this document is printed as a poster. The poster consists of frames. Frame is one paper sheet, it has size of the printer's paper (FrameWidthPix x FrameHeightPix, orientation Orientation).

The poster consists of Ceil(FrameCountX) x Ceil(FrameCountY) frames (so, each page of the original document will be printed on Ceil(FrameCountX)*Ceil(

FrameCountY) printer pages).

The poster size in pixels is PageWidthPix x PageHeightPix (i.e. Ceil(FrameCountX)*FrameWidthPix x Ceil(FrameCountY)*FrameHeightPix).

FrameCountX  and FrameCountY can be fractional values (if IntegerCount  = False), it affects calculation of RealWidth and RealHeight  (see below).

Sizes in posters

Sizes in posters

How the document page is scaled

As it was said above, each page of the original document is scaled to RealWidth x RealHeight.

If ScaleImage = True, pages are scaled to the full poster size (RealWidth = PageWidthPix , RealHeight = PageHeightPix), without keeping the original proportions.

If ScaleImage = False, pages are scaled proportionally to the maximal size that fits in TotalFrameWPix x TotalFrameHPix (so RealWidth<=TotalFrameWPix, RealHeight<=TotalFrameHPix).

TotalFrameWPix  and TotalFrameHPix are similar to PageWidthPix and PageHeightPix, but calculated without rounding, i.e. they are equal to FrameCountX*FrameWidthPix x FrameCountY*FrameHeightPix.

If ScaleImage = False, the document page can be printed in the top left corner or in the center of the poster, depending on the Center property.

See also: UsePhysicalOffsets.

Printing and previewing

The main printing methods are Print and PrintPages. See also PrintFrame, PrintFrames, PrintFramesEx.

A print preview is displayed by TSRVPreview component.

You can provide a visual indication of printing progress using OnSendingToPrinter event.

To make printing output compatible with metafiles, assign MetafileCompatibility=True (and probably, NoMetafiles=True). It may be necessary for some virtual printers