|
How to use Print Suite components?
The using of Print Suite Component as simple as 1-2-3!
<1>
Drop TPrintJob component onto your form, set the needed page count using the PageCount property and draw your graphics for each page in the OnDraw event. The example code below draws the centered page index on each page.
procedure TfrmMain.psjSimplestDraw(Sender: TObject; TheCanvas: TCanvas;
PageIndex: Integer; Rect: TRect; Area: TDrawArea; Target: TDrawTarget);
var
S: string;
begin
if Area=daPage then
with Rect,TheCanvas,Font do
begin
// setting font properties
Name:='Arial';
Size:=200;
Style:=[fsBold];
// drawing text
S:=IntToStr(PageIndex);
TextOut(
(Left+Right-TextWidth(S)) div 2,
(Top+Bottom-TextHeight(S)) div 2,
S);
end;
end;
<2>
Drop TPreview component onto your form and connect it to your print job using the PrintJob property. Drop TPreviewToolbar and TPreviewStatusBar and link them with TPreview component using the Preview property if you want to control your preview with easy.
<3>
Call the PrintDialog, Print or PrintEx method of TPrintJob component to print your graphics. The Title property contains the print job title that is displayed in the Windows' print job list.
|