How to Start Convert PDF Read PDF Edit PDF PDF Report Builder Work with PDF Modules PDF Document PDF Pages Text Image Graph & Path Annotation, Markup & Drawing Redaction Security Digital Signature Forms Watermark Bookmark Link File Attachment File Metadata Printing Work with Other SDKs Barcode read Barcode create OCR Twain

C# PDF to Bitmap Library
How to convert PDF page to bitmap (.bmp) image using C#.net in asp.net, windows forms application


C#.NET PDF page to BMP image Convertion without open source library, such as itextsharp, pdfsharp, imagemagick.





In this C# tutorial, you will learn how to convert PDF pages to bitmap (.bmp) images using C# in ASP.NET MVC web app, and Windows Forms application.

How to convert PDF page to Bitmap image using C#

  1. Download XDoc.PDF Bitmap Converter C# library
  2. Install C# library to convert PDF page to BMP image
  3. Step by Step Tutorial












C#.NET PDF to BMP converter control SDK from RasterEdge DocImage SDK for .NET can easily and quickly transform & convert multi-page PDF document into separate BMP image files with no loss in content quality.

C#.NET PDF document converting library control from RasterEdge XDoc.PDF SDK for .NET can not only convert PDF document to BMP image but also own other PDF-to-image converting functionalities, like how to convert PDF to JPEG using C#.NET, how to convert PDF to PNG using C#.NET, and how to convert PDF to TIFF using C#.NET.





How to convert PDF page to Bitmap image using C#.NET


The following steps and sample c# code will show how to quickly convert a PDF page to BMP image.

  1. Create a new PDFDocument with an existing PDF file loaded
  2. Create a new PDFPage object from the first page of the PDF document
  3. Call PDFPage.ConvertToImage() to convert PDF page to a bitmap (.bmp) file


            String inputFilePath = @"W:\Projects\Test-Files\file1.pdf";
            String outputFilePath = @"W:\Projects\Test-Output\RasterEdge.com\pdf-convert-pdf-to-bmp-start.bmp";

            //  Open file and get the target page
            PDFDocument doc = new PDFDocument(inputFilePath);

            PDFPage page = (PDFPage)doc.GetPage(0);
            //  Convert page to a .BMP image
            page.ConvertToImage(ImageType.BMP, outputFilePath);




PDF to Bitmap Image Options Using C#


In your C# code, you can utilize class "ImageOutputOption" to apply the converted bmp image options.


  1. Color: Output Bitmap image color is Monochrome, Gray, Color.

  2. Zoom: Set zoom value to 2F. Use more pixels to render a PDF page to bitmap.

  3. Resolution: Set bitmap image resolution value in the BMP file.



            String inputFilePath = @"W:\Projects\Test-Files\file1.pdf";
            String outputFilePath = @"W:\Projects\Test-Output\RasterEdge.com\pdf-convert-pdf-to-bmp.bmp";

            ImageOutputOption options = new ImageOutputOption();
            options.Type = ImageType.BMP;

            //  Output image is Monochrome, Gray, Color.
            options.Color = ColorType.Gray;
            //  Set zoom value to 2F. Use more pixels to render the PDF page.
            options.Zoom = 2F;
            //  Set resolution value in the Bitmap file to 300 dpi.
            options.Resolution = 300;

            //  Open file and get the target page
            PDFDocument doc = new PDFDocument(inputFilePath);
            PDFPage page = (PDFPage)doc.GetPage(0);

            //  Convert page to a Bitmap (.bmp) image
            page.ConvertToImage(options, outputFilePath);






How to preview PDF in bitmap image using C# .NET


To preview PDF as bitmap image, you need follow the steps below and C# source code.

  1. In ImageOutputOption, set image type as ImageType.BMP. Set image color as ColorType.Color
  2. Set image Zoom to 0.25F. You need preview the first page of PDF in a smaller area.
  3. Set image Resolution to 300. To improve the preview image quality, you need bitmap image with larger resolution.
  4. Get the first page of PDF file
  5. Convert the PDF page to the bitmap image file


            String inputFilePath = @"W:\Projects\Test-Files\file1.pdf";
            String outputFilePath = @"W:\Projects\Test-Output\RasterEdge.com\pdf-convert-pdf-to-bmp-preview.bmp";

            ImageOutputOption options = new ImageOutputOption();
            options.Type = ImageType.BMP;

            //  Output image is Monochrome, Gray, Color.
            options.Color = ColorType.Color;
            //  Set zoom value to 2F. Use less pixel and smaller area to render the first page of PDF
            options.Zoom = 0.25F;
            //  Set resolution value in the bitmap file to 300 dpi.
            options.Resolution = 300;

            //  Open file and get the target page
            PDFDocument doc = new PDFDocument(inputFilePath);
            PDFPage page = (PDFPage)doc.GetPage(0);

            //  Convert page to a Bitmap (.bmp) image
            page.ConvertToImage(options, outputFilePath);