Skip to main content

Customizing the Viewer Layout

Version: 2.0

Customizing the Viewer Layout

The design and layout of the window using the DynamicPDF Viewer control can be customized to meet the needs of the given application. This is accomplished with the layout and customization of the three main controls within DynamicPDF Viewer for .NET: the PdfViewer, the PdfToolStrip and the PdfNavigationaPanel (see the Overview topic for more on these elements).

Default Behaviour​

When a PdfViewer control is added to a Windows Form it will contain one PdfToolStrip and one PdfNavigationaPanel by default. The PdfToolStrip will be across the top and the PdfNavigationPanel will run along the left side of the screen and expand out toward the right. Both the default tool strip and the navigation panel will already be associated with the Viewer control and will function as is as you would expect any PDF viewer to function. If size or location of the PdfToolStrip or PdfNavigationaPanel needs to be customized then the default NavigationPanel and ToolStrip should be turned off and a new PdfNavigationaPanel or PdfToolStrip should be added and customized as needed (see the following two topics below for more).

Turning off the Default NavigationPanel or ToolStrip​

Turning off the entire default NavigationPanel or Toolstrip is accomplished using the following:

pdfViewer1.ShowNavigationPanel = false;
pdfViewer1.ShowToolStrip = false;
MyPdfViewer1.ShowNavigationPanel = False
MyPdfViewer1.ShowToolStrip = False

Adding and Associating Additional PdfNaviagtionPanels or PdfToolStrips​

Within any Windows application, any number of additional PdfNavigationPanels or PdfToolStrips can be added. Each additional NavigationPanel and ToolStrip will need explicit association with a particular PdfViewer. Both PdfNavigationaPanel and PdfToolStrip expose an “AssociateToPdfViewer” method that must be called in order to create the association.

Associating a PdfNavigationaPanel and a PdfToolStrip is accomplished using the following:

Opening a Specific Page​

pdfNavigationPanel1.AssociateToPdfViewer(pdfViewer1);
pdfToolStrip1.AssociateToPdfViewer(pdfViewer1);
MyPdfNavigationPanel1.AssociateToPdfViewer(MyPdfViewer1)
MyPdfToolStrip1.AssociateToPdfViewer(MyPdfViewer1)

Disassociating a PdfNaviagtionPanel or PdfToolStrip​

Passing a null or nothing into an AssociateToPdfViewer method will disassociate that PdfNavigationaPanel or PdfToolStrip from the PdfViewer. Also, when a PdfViewer is disposed, any PdfToolStrip or PdfNavigationaPanel associated to it will get detached from the PdfViewer automatically.

Customizing a PdfToolStrip​

Adding or removing PdfToolStrip items or modifying the existing one is completed much like any other ToolStrips in .NET (in fact, the PdfToolStrip contains a .NET ToolStrip). Using the Items collection within the ToolStrip, items properties can be accessed or items can be added or removed.

Removing the Print button from a PdfToolStrip can be accomplished using the following:

Print Button pdfToolStrip1.ToolStrip.Items[2].Visible = false;
Section Divider pdfToolStrip1.ToolStrip.Items[3].Visible = false;
Print Button pdfToolStrip1.ToolStrip.Items[2].Visible = False
Section Divider pdfToolStrip1.ToolStrip.Items[3].Visible = False

Customizing a PdfNavigationPanel​

Several things can be done within a PdfNavigationaPanel to customize how it is presented and interacted with. The PdfNavigationaPanel can be customized by:

  • Showing only Bookmarks or only Thumbnails
  • Expanding Bookmarks, Thumbnails or neither by default
  • Showing the Bookmark or Thumbnail icons when the panel is expanded
  • Showing the small collapse icon when the panel is expanded

A PdfNavigationaPanel that shows only Thumbnails and has it expanded by default can be accomplished using the following:

pdfViewer1.InitialVisibleNavigationPane = ceTe.DynamicPDF.Viewer.NavigationPane.PageThumbnail;
pdfNavigationPanel1.ShowBookmarkIcon = false;
MyPdfViewer1.InitialVisibleNavigationPane = ceTe.DynamicPDF.Viewer.NavigationPane.PageThumbnail
MyPdfNavigationPanel1.ShowBookmarkIcon = False