Products
PDFControls.NET 2.0
Created
9/22/2015
Tags
UI View

This sample shows how you can create a thumbnail viewer for your PDF application and it builds on the SimpleViewer code sample. The ThumbnailsViewer class creates an interface from which you can easily get an overview of all the pdf pages in the document. In short, the ThumbnailsViewer has a LayoutManager which manages how the thumbnails are ordered, and a link is made to the PageViewer to synchronize the views and a link is made to the PDF document.

PDF-Controls-Thumbnail-viewer.png

TallComponents.Interaction.LayoutManagers.AutoColumnGridLayoutManager autoColumnGridLayoutManager1 = 
new TallComponents.Interaction.LayoutManagers.AutoColumnGridLayoutManager();
TallComponents.PDF.Spacing spacing1 = new TallComponents.PDF.Spacing();
TallComponents.PDF.Spacing spacing2 = new TallComponents.PDF.Spacing();

this.thumbnailsViewer1.ActionHandler = null;
this.thumbnailsViewer1.Dock = System.Windows.Forms.DockStyle.Fill;
          
//couple the thumbnailsViewer to the pdf document
this.thumbnailsViewer1.Document = this.document1;
         
//draw a red rectangle to indicate what parts of the pdf pages are visible
this.thumbnailsViewer1.DrawPagesViewerRectangles = true;
this.thumbnailsViewer1.HideHorizontalScrollbar = false;
this.thumbnailsViewer1.HideVerticalScrollbar = false;
autoColumnGridLayoutManager1.ColumnCount = 1;
autoColumnGridLayoutManager1.Indent = 0;
spacing1.Bottom = 75;
spacing1.Left = 75;
spacing1.Right = 75;
spacing1.Top = 75;
autoColumnGridLayoutManager1.Margin = spacing1;
spacing2.Bottom = 75;
spacing2.Left = 75;
spacing2.Right = 75;
spacing2.Top = 75;
autoColumnGridLayoutManager1.Spacing = spacing2;
this.thumbnailsViewer1.LayoutManager = autoColumnGridLayoutManager1;
this.thumbnailsViewer1.Location = new System.Drawing.Point(0, 0);
this.thumbnailsViewer1.MaxZoom = 0.8;
this.thumbnailsViewer1.MinZoom = 0.02;
this.thumbnailsViewer1.Name = "thumbnailsViewer1";

//couple the thumbnailsViewer to the pagesViewer to couple clicking actions
this.thumbnailsViewer1.PagesViewer = this.pagesViewer1;
this.thumbnailsViewer1.Size = new System.Drawing.Size(199, 431);
this.thumbnailsViewer1.TabIndex = 0;
this.thumbnailsViewer1.Text = "thumbnailsViewer1";
this.thumbnailsViewer1.VisibleLeft = 0;
this.thumbnailsViewer1.VisibleTop = 0;
this.thumbnailsViewer1.ZoomFactor = 0.125;