PdfViewer.CreateThumbnail

Create a thumbnail for the page number specified as parameter and returns a Bitmap of size best fit within provided size parameter.

public Bitmap CreateThumbnail(int pageNumber, Size bitmapSize)
Function CreateThumbnail(pageNumber As Integer, bitmapSize As Size) As Bitmap

Parameters

pageNumber
Int32

Page number of the required thumbnail.

bitmapSize
Size

Thumbnail will be created to best fit within this given size.

Returns

Bitmap

A Bitmap containing thumbnail of the specified page number with a size best fit to the size provided as parameter.

Licensing Info

This method is a DynamicPDF Viewer feature. One of the following is required for non-evaluation usage:

Examples

The following example will show how to move to a page by specifying its number.

Imports System
Imports System.Windows.Forms
Imports ceTe.DynamicPDF.Viewer

Public Class Form1
    Inherits System.Windows.Forms.Form

    Private MyPdfViewer As PdfViewer

    Sub New()
        InitializeComponent()
    End Sub

    Private Sub InitializeComponent()
        Me.MyPdfViewer = New PdfViewer()
        Me.Controls.Add(MyPdfViewer)
    End Sub

    Shared Sub Main()
        Application.Run(New Form1())
    End Sub			
    
	Private Sub CreateThumbnail()
		Dim thumb As System.Drawing.Bitmap
		' Open document in viewer.
		MyPdfViewer.Open("C:\MyDocument.pdf")

		' Create a Thumbnail.
		' PageNumber ranges from '1' to 'count' of the pages in the document.
		' Size of thumb will be such that the longer edge will be 200 pixcels.
		thumb = MyPdfViewer.CreateThumbnail(1, New  new Size(200, 200))
		thumb.Save("C:\MyThumb.png")
	End Sub

End Class						
using System;
using System.Windows.Forms;
using ceTe.DynamicPDF.Viewer;

namespace DynamicPDFViewerDemo
{
    public class Form1 : Form
    {
        private ceTe.DynamicPDF.Viewer.PdfViewer dpdfViewer;

        public Form1()
        {
            InitializeComponent();
        }

        [STAThread]
        static void Main()
        {
            Application.Run(new Form1());
        }		
			
        private void InitializeComponent()
        {
            this.dpdfViewer = new PdfViewer();
            this.Controls.Add(dpdfViewer);
        }

        private void NavigateToPagenumber()
        {
            // Open document in viewer.
            Open(@"C:\MyDocument.pdf");

            // Create a Thumbnail
			// PageNumber ranges from '1' to 'count' of the pages in the document.
			// Size of thumb will be such that the longer edge will be 200 pixcels.
            System.Drawing.Bitmap thumb = CreateThumbnail(1, new  new Size(200, 200));
            thumb.Save(@"C:\MyThumb.png");
        }
    }
}

Remarks

The page number should be a non zero based index. The size may not be same as provided as parameter but it will fit within the box of the provided size.

See Also

PdfViewer
ceTe.DynamicPDF.Viewer

In this topic