We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to display/generate PDF pages as thumbnails?

Platform: ASP.NET MVC |
Control: PdfViewer

Displaying PDF document pages as thumbnails

PDF Viewer for ASP.NET MVC does not support displaying thumbnails of the PDF file loaded, however as a workaround, the PDF pages are displayed as thumbnail by exporting the pages as images. Clicking the thumbnail image will navigate to the corresponding page in PDF Viewer.


You can export the Pdf document pages as images using the Syncfusion PDF Base library’s PdfLoadedDocument.ExportAsImage() method.  Refer to the following steps to create and display the PDF pages as thumbnail.

Step 1: Create the thumbnail pane using the HTML.

<div style="width:100%; height:760px;">
    <div style="left:2px;">
        <div id="thumbnailpane" style="overflow:scroll; width:15%;height:640px">
    <div style="left:20%; position: absolute; width:80%; top:50px; height:780px">
        <div class="content-container-fluid">
            <div class="row">
                <div class="cols-sample-area">
                    <div class="control">
                        <div id="container"></div>

Step 2: Sending AJAX request to create the thumbnail images in the server-side and in the success of the AJAX request, PDF Viewer will be initialized.

        url: '../api/PdfViewer/ExportAsImage',
        type: 'POST',
        dataType: 'json',
        crossDomain: true,
        traditional: true,
        contentType: 'application/json; charset=utf-8',
        data: '',
        success: function (data) {
            //Initializes PDF viewer
            $('#container').ejPdfViewer({ serviceUrl: '../api/PdfViewer', documentLoad: 'onDocumentLoad' })
        error: function (msg, textStatus, errorThrown) {
            alert('Exception' + msg.responseText);

Step 3: Export the PDF pages as images using the PdfLoadedDocument’s ExportAsImage() API.

public object ExportAsImage()
            PdfLoadedDocument loadedDocument = new PdfLoadedDocument(HttpContext.Current.Server.MapPath("~/Data/HTTP Succinctly.pdf"));
            //Exports the loaded  PDF document to as images
            Bitmap[] extportedImages = loadedDocument.ExportAsImage(0, loadedDocument.Pages.Count - 1);
            string outputPath = HttpContext.Current.Server.MapPath("~/Images/");
            for (int i = 0; i < extportedImages.Length; i++)
                extportedImages [i].Save(outputPath + "\\Image" + (i + 1) + ".png");
            string output = (loadedDocument.Pages.Count).ToString();
            return output;

Step 4: Place the images in the thumbnail pane.

function thumbnail(totalpage) {
        //Place the exported images in thumbnail pane
        var thumbdiv = document.getElementById("thumbnailpane");
        for (var i = 1; i <= totalpage; i++) {
            var thumbimg = document.createElement('div');
            thumbimg.className = 'thumbnail';
            var img = document.createElement('img');
            img.src = '../images/image' + i + '.png';
            thumbimg.onclick = function (e) {
                var pagenum = e.currentTarget.id;
            thumbimg.id = i;

Step 5: Click the thumbnail image to navigate to the corresponding page in PDF Viewer.

    function gotopage(pagenum) {
        var pdfviewerObject = $('#container').data('ejPdfViewer');
        //Navigates to given page number



Executing the previously given sample will provide the output as follows. Clicking the thumbnail image will display the corresponding page in PDF Viewer.

Sample image for Http


You can find the PDF Viewer’s other options like adding Toolbar Customization, TextMarkup annotation, and Handwritten Signature features here with code examples.


Refer here to explore the rich set of PDF Viewer features.


An online demo link to view PDF documents using Syncfusion PDF Viewer.


See Also:








2X faster development

The ultimate ASP.NET MVC UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile