PDF to BMP - pqScan.com
C# PDF to BMP Conversion Online Tutorial for Converting PDF into BMP Image Files in C# Application Online Demo Download Trial Purchase Now

How to Convert PDF to BMP in C# .NET?

back to home  >  .NET PDF to Image SDK  >  How to Convert PDF to Image in .NET  >  Convert PDF File to BMP Image Using C#

Now, let's get started to convert PDF document to BMP images in your C# application! Please keep in mind that steps below are only for your reference. You may decide whether to use all the PDF to BMP converting functions illustrated according to your C# project requirement. Do contact us (support@pqscan.com) if you have any questions. pqScan is always ready to help.

  • Launch Visual Studio (2005+) and create a new console project using C# programming language;
  • Download pqScan .NET PDF to Image SDK Trial and add the DLL to project reference;
  • Copy and paste free C# sample code below to your project;

PDF to BMP Image Conversion - C# Sample

The following free C# sample code shows how to convert PDF to BMP image in Visual Studio .NET project. You may also get more details for .NET PDF to BMP converting properties and APIs here.

using System;
using System.Drawing;
using System.Drawing.Imaging;
using PQScan.PDFToImage;

namespace PDF2BMP
{
  class Program
  {
    static void Main(string[] args)
    {
      // Create an instance of PQScan.PDFToImage.PDFDocument object.
      PDFDocument pdfDoc = new PDFDocument();

      // Load a PDF document.
      pdfDoc.LoadPDF("sample.pdf");

      // Get the total page count.
      int count = pdfDoc.PageCount;

      for (int i = 0; i < count; i++)
      {
        // Rasterize PDF page to image.
        Bitmap bitmap = pdfDoc.ToImage(i);

        // Save image to bmp file type.
        bitmap.Save("output" + i + ".bmp", ImageFormat.Bmp);
      }
    }
  }
}

In addition, here's a C# coding sample for how to load a PDF from stream and transform it to the right size BMP image file. That is to say, you are empowered to customize the size of output BMP image according to your specific PDF document converting requirement.

using System;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
using PQScan.PDFToImage;

namespace PDFToBMP
{
  class Program
  {
    static void Main(string[] args)
    {
      // Make a new instance of PQScan.PDFToImage.PDFDocument object.
      PDFDocument pdf = new PDFDocument();

      // Create a file stream with PDF information.
      FileStream stream = new FileStream("sample.pdf", FileMode.Open);

      // Load PDF document from file stream.
      pdf.LoadPDF(stream);

      // Set output bmp image width.
      int width = pdf.GetPageWidth(0) / 2;

      // Set output bmp image height.
      int height = pdf.GetPageHeight(0) / 2;

      // Convert the first page of PDF to image with the desired size.
      Bitmap bmp = pdf.ToImage(0, width, height);

      // Save image to bmp image file format.
      bmp.Save("result.bmp", ImageFormat.Bmp);
    }
  }
}

convert pdf to bmp in c#

If you want to resize BMP image and change its quality through DPI, you may refer to this online C# tutorial: How to customize (BMP) image converted from PDF page using C#.

pqScan SDK
.NET PDF to Image Software
Online Guide
.NET PDF to Image Converting
Conversion Type
.NET Converter: PDF to TIFF .NET Converter: PDF to BMP C# Converter: PDF to TIFF C# Converter: PDF to PNG VB.NET Converter: PDF to Multi-page TIFF ASP.NET Converter: PDF to JPG ASP.NET Converter: PDF to TIFF ASP.NET Converter: PDF to PNG View All Image Types >>
I ordered .NET PDF to Image SDK from pqScan.com and it was confirmed immediately. The SDK is all that I expected. After comparison with others in the market, I would like to say the price couldn't have been better. Thank you, pqScan! Marvin Dunn