XDoc.PDF
Features
Tech Specs
How-to C#
How-to VB.NET
Pricing
C# PDF: How to HTML5 Viewer & Editor PDF Create PDF Export File and Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print WPF Viewer & Editor Work with Other SDKs Barcode Read Barcode Create OCR Twain
Page: Create Thumbnails
  |  
Home ›› XDoc.PDF ›› C# PDF: Create Thumbnails

How to generate, make, preview PDF document thumbnail image icons in C#.NET


C# Demo Code to enable PDF thumbnail generator viewers in C# class, ASP.NET online pages in .NET Project




Advanced C#.NET framework PDF SDK for thumbnail icon generation & creator from PDF document pages in Visual Stutio .NET framework


Easy .net sdk library for showing, previewing PDF page thumbnails for navigation in both .NET WinForms application and ASP.NET webpage


Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint


Create, show, display multiple image formats thumbnails for PDF file, such as jpeg, png, gif, bmp, etc


C# sample code included for quick creating PDF thumbnail viewer in Visual C# .NET class


Able to control the size of PDF thumbnails in C#.NET console application and ASPX webpage


Built on .NET framework 2.0 and support Windows 32-bit and 64-bit systems


You can navigate through PDF document in your C#.NET application via thumbnail. And generating thumbnail for PDF document is an easy work. Please see C# programming example as below.





C# create Adobe pdf file thumbnail images with specified image size (width, height)


Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:

       

       If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.

       

       If using x86, the platform target should be x86.




        #region generated pdf file thumbnails with specified image size
        internal static void generatePdfThumbnailWithSpecifiedSize()
        {
            String inputFilePath = @"C:\demo.pdf";
            PDFDocument doc = new PDFDocument(inputFilePath);
            for (int i = 0; i < doc.GetPageCount();i++ )
            {
                BasePage page = doc.GetPage(i);
                Bitmap image = page.ConvertToImageFitWidth(100);
            }
        }
        #endregion




C# generate, get pdf thumbnail files for selected PDF pages





        #region generated pdf file page's thumbnails with specified image size
        internal static void generatePdfPageThumbnailWithSpecifiedSize()
        {
            String inputFilePath = @"C:\demo.pdf";
            PDFDocument doc = new PDFDocument(inputFilePath);
            int pageIndex = 2;
            BasePage page = doc.GetPage(pageIndex);
            Bitmap image = page.ConvertToImageFitWidth(100);
        }
        #endregion




.NET Class Namespace Required



Add necessary references:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XImage.Raster.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XDoc.PDF.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.PDF;





public override Bitmap ConvertToImage()

Description:
     Convert the PDF page to bitmap as the default setting, source page size, resolution = 96.

Return:
     A bitmap object, null if failed.



public override Bitmap ConvertToImage(float zoomValue)

Description:
     Convert the PDF page to bitmap with specified zoom value.

Parameters:

Return:
     A bitmap object, null if failed.



public override Bitmap ConvertToImage(int resolution)

Description:
     Convert the PDF page to bitmap with specified resolution.

Parameters:

Return:
     A bitmap object, null if failed.



public override Bitmap ConvertToImage(Size targetSize)

Description:
     Convert the PDF page to bitmap with specified size.

Parameters:

Return:
     A bitmap object, null if failed.



public override Bitmap ConvertToImageFitHeight(int height)

Description:
     Convert the PDF page to bitmap with specified height and the width will be zoomed as scaling height.

Parameters:

Return:
     A bitmap object, null if failed.



public override Bitmap ConvertToImageFitWidth(int width)

Description:
     Convert the PDF page to bitmap with specified width and the height will be zoomed as scaling width.

Parameters:

Return:
     A bitmap object, null if failed.



public override void ConvertToImage(ImageType targetType, String filePath)

Description:
     Convert the PDF page to bitmap with specified format and save it on the disk.

Parameters:



public override void ConvertToImage(ImageType targetType, float zoomValue, String filePath)

Description:
     Convert the PDF page to bitmap with specified format & zoom value and save it on the disk.

Parameters:



public override void ConvertToImage(ImageType targetType, int resolution, String filePath)

Description:
     Convert the PDF page to bitmap with specified format & resolution and save it on the disk.

Parameters:



public override byte[] ConvertToImageBytes(ImageType targetType)

Description:
     Convert the PDF page to bitmap byte array with specified format.

Parameters:

Return:
     A byte array, null or empty byte array if failed.



public override byte[] ConvertToImageBytes(ImageType targetType, float zoomValue)

Description:
     Convert the PDF page to bitmap byte array with specified format & zoom value.

Parameters:

Return:
     A byte array, null or empty byte array if failed.



public override byte[] ConvertToImageBytes(ImageType targetType, int targetResolution)

Description:
     Convert the PDF page to bitmap byte array with specified format & resolution.

Parameters:

Return:
     A byte array, null or empty byte array if failed.



public override void ConvertToImageStream(ImageType targetType, Stream stream)

Description:
     Convert the PDF page to bitmap stream with specified format.

Parameters:



public override void ConvertToImageStream(ImageType targetType, float zoomValue, Stream stream)

Description:
     Convert the PDF page to bitmap stream with specified format & zoom value.

Parameters:



public override void ConvertToImageStream(ImageType targetType, int resolution, Stream stream)

Description:
     Convert the PDF page to bitmap stream with specified format & resolution.

Parameters:



public override void ConvertToImage(ImageType targetType, ImageOutputOption option, String filePath)

Description:
     Convert the PDF page to bitmap with specified settings and save it on the disk.

Parameters:



public override void ConvertToImage(ImageType targetType, ImageOutputOption option, Stream stream)

Description:
     Convert the PDF page to bitmap with specified settings and save it into a new stream.

Parameters: