ViewControls and ViewOptions

<< Click to Display Table of Contents >>

Navigation:  Tasks > Change GUI >

ViewControls and ViewOptions

If you prefer a single page view, please use

 

Command( COMPDF_SinglepageMode, 1 )

 

(the main windows shows only one page and does not scroll)

 

Using the property ViewControls (.NET enum eViewControls) You can select optional GUI elements.

View_Controls

 

VCL

    WPViewPDF1.ViewControls := [wpViewLeftPanel, wpHorzScrollBar, wpVertScrollBar,wpNavigationPanel, wpPropertyPanel, wpViewPanel];

 

NET

    pdfViewer1.ViewControls =

        eViewControls.wpHorzScrollBar |

        eViewControls.wpNavigationPanel |

        eViewControls.wpPropertyPanel |

        eViewControls.wpVertScrollBar |

        eViewControls.wpViewPanel;

 

 

The property ViewOptions (.NET type: eViewOptions) controls how the page is rendered and how the GUI elements work:

 

wpDontUseHyperlinks : Hyperlinks are ignored - however the hyperlink event will still be triggered.

wpDontHighlightLinks: Hyperlinks will not painted with a blue background

wpNoHyperlinkCursor: Do not switch to hand point cursor on links.

 

wpDontAskForPassword: When a PDF requires a password the control will not ask for one.

wpSelectPage: The user can select pages by pressing Ctrl+Cursor left/right

wpPageMultiSelection: like wpSelectPage

wpShowPageSelection: (wrong name) Allow page selection with PageUp + Down + Shift / Ctrl

wpDisablePagenrHint: Don't display a page number during scrolling

wpDisableZoomHint: Don't display a zoome value during zooming

wpDisableBookmarkView: Do not load bookmarks

wpInactivateHyperlinks: Display hyperlinks but do not use the internal jump on clicks

wpExpandAllBookmarks: Expand all bookmarks

wpShowDeletionCross: Show pages which are marked for deletion with a cross

wpPaintCursor: (not used by WPViewPDF Standard and PLUS) Paint a cursor in PDF text paths

wpPaintPathRects: Show rectangle around text paths

wpPaintObjectsRects: Show frames for all draw objects

wpPaintObjectsSizers: Show sizer rectangles when a draw object is selected

wpHighlightFields: Show colored backgrounds for fields (widget annotations)

wpViewThumbnails: Enable display thumbnails in left panel

           - use CommandEx(COMPDF_SetPageModeDefault, val) to actually display them

wpAllowPageDragging : Allows move of selected pages

wpHidePageSelection : Disable display of selection in main viewer

wpHidePageSelectionThumbnails: disable display of selection in thumbnail viewer

wpInteractiveThumbnails: Allows page moving in thumbnail viewer

wpThumbnailAtozoomToSquareWH : reserve the maximum square rectangle for thumbnails. This avoids scaling when pages are rotated.

wpHideFocusRectThumbnails: Hide the red line which highlights the current page

 

 

 

 

VCL

WPViewPDF1.ViewOptions :=

   [wpExpandAllBookmarks,

   wpSelectPage,

   wpShowPageSelection,

   wpPageMultiSelection];

 

NET

pdfViewer1.ViewOptions =

  eViewOptions.wpExpandAllBookmarks |

  eViewOptions.wpExpandAllBookmarks |

  eViewOptions.wpSelectPage |

  eViewOptions.wpShowPageSelection;

 

 

You can also select the background color for the viewer.

 

Use this commands:

 

COMPDF_SETDESKCOLOR (=53): select the color for the background

COMPDF_SETDESKCOLORTO (=59): select the bottom color for the background. If it was specified, the background will use a marquee effect.

 

COMPDF_SETPAPERCOLOR (=54): Select the paper color. The standard is clWhite.

 

 

You can also hide the page frame (thin black line round paper) or show the page numbers.

 

COMPDF_SetExViewOptions (=81) requires a bitfield::

 

  1: Show Page Numbers in main viewer (default: no page numbers)

  2: Hide Page Frames in main viewer    (default: frames)

  4: FastZoom Mode in main viewer       (default: off)

  16: Hide Page Numbers in thumbnail viewer   (default: display page numbers)

  32: Hide Page Frames in thumbnail viewer     (default: frames)

  64: FastZoom Mode in thumbnail viewer        (default: off)

 

COMPDF_SetPageNumberString

 

This command can be used to set a format string for the page number display. Default is " %d "

 

An alternative would be "Page %d of %d" to display "Page 1 of 100" under pages.

 

COMPDF_ShowNavigation  = 134

 

This command can be used to force the display of the navigation panel (Bookmarks and Thumbnails).

Use IntPar=0 to hide it, 1 to show it and 2 to toggle its visibility.

 

COMPDF_SetPageModeDefault = 615:

  0=Auto, 1=None, 2=Outlines, 3=Thumbnails

  (Note: The VCL has the property PageModeDefault)

 

  This command disables, that the user can switch off the navigation n(left) panel and

  it stays switched off after loading a new file.

 It further can override the PageMode defined in the PDF:

 

COMPDF_EnableNavigationAfterLoad = 616:

  0: AsBeforeLoad - persistent, default

  1: AsDefinedInDefaultPageMode - always use COMPDF_SetPageModeDefault

  2: DefinedInPDFOrDefault - reset navigation after loading a new file

 

 

Delphi Example:

Display the thumbnails from the beginning (after loading a PDF file)

 

   FViewer := TWPViewPDF.Create(Parent); // Parent can be a TPanel for example

   FViewer.Parent := Parent;

   FViewer.ViewControls := [ wpViewLeftPanel, wpViewPanel,  wpVertScrollBar, wpHorzScrollBar ];

   FViewer.ViewOptions  := [ wpViewThumbnails ];

   FViewer.PageModeDefault := wpPageModeThumbnails;

   FViewer.SetBounds(1,1,Parent.Width-2,Parent.Height-2);