Zooming

<< Click to Display Table of Contents >>

Navigation:  Tasks > Change GUI >

Zooming

Control Zooming:

 

 COMPDF_Zoom100            = 41.............! 100 % Zoom

 COMPDF_ZoomIn             = 42.............!  + 10%

 COMPDF_Zoom               = 43.............! Zoom to StrPar/IntPar - if IntPar=0 retrieve zoom!

 

if StrParam = "MP" zooming will center to mouse position

if StrParam = "RECT" the viewer will zoom to the frame rectangle which was drawn last. This allows the implementation

of a zoom tool.

 

 COMPDF_ZoomOut            = 44.............!  - 10%

 COMPDF_ZoomFullWidth      = 45.............! Page Width

 COMPDF_ZoomFullPage       = 46.............! Page Width

 COMPDF_ZoomTwoPages       = 47.............! Toggle 2 Pages Display

 COMPDF_ZoomThumbs         = 48.............! Thumbnail Preview

 

Note: Maximum zooming value is 500

 

To read the current zooming use

 COMPDF_ZoomGetCurrent   (= 49).............! read current zoom

 

This command saves and restores the zooming

 

 COMPDF_ZoomSaveRestore    = 76;

 

IntPar=1 Saves, IntPar=0 Restores

 

This command controlls zooming in thumbnail window (left panel)

COMPDF_ZoomThumbnails     = 77;

 

Set the auto zoom property of the thumbnail view

COMPDF_ZoomThumbnailsAuto = 79;

  0 = Off

  1 = Width

  2 = FullPage

  3 = SideBySide

  4 = AsManyAsPossibleInRow

  5 = AsManyAsPossibleInRowMinOne  (=default - adjust zooming to show full page)

 

 

IntPar>=10 sets the thumbnail zoomsize (default 12), -9..9 increases or decreases the zoom value

 

 

 

 

clip0012

 

Example:

 

Implementation of Zoom Tool:

 

var FSelectZoomRect, FSaveToClip : Boolean;

 

procedure TWPViewPDFDemo.ZoomToolClick(Sender: TObject);

begin

   FSelectZoomRect := true;

   WPViewPDF1.CommandEx(COMPDF_SelectMode, 2);

end;

 

Use the OnSelRectEvent event:

 

procedure TWPViewPDFDemo.DoSelRectEvent(Sender: TObject; const PageNr: Integer;

  R: TRect);

begin

  if FSelectZoomRect then

  begin

     Screen.Cursor := crDefault;

     WPViewPDF1.CommandStr(COMPDF_ZOOM, 'RECT');

  end else 

   // This code is used to capture a bitmap

  if FSaveToClip then

  begin

     if WPViewPDF1.CommandEx(COMPDF_SaveBMPToClipboard, 200)>0 then  // Save in 200 dpi quality

        ShowMessage('An image @200 dpi was copied to clipboard.');

  end else

   // This code is used to capture as text

  if FCopyTextRect then

  begin

     if WPViewPDF1.CommandEx(COMPDF_CopyToClibrd,8)>0 then

         ShowMessage('Text copied to clipboard.');

  end;

end;