PDF to JPEG - pqScan.com
C# PDF to JPG Conversion How to Change and Convert PDF into JPEG/JPG Image Files in C# Programming Online Demo Download Trial Purchase Now

How to Convert PDF to JPG/JPEG in C# .NET?

back to home  >  .NET PDF to Image SDK  >  How to Convert PDF to Image in .NET  >  Use Free C# Demo to Convert PDF to JPEG

As we know, there are a lot of needs of converting PDF document pages to JPEG/JPG images, especially for C# .NET application development, but it's not an easy work without the help of third-party PDF converter software. For this reason, pqScan.com develops a .NET PDF document convertor solution which is easily integrated in C# program.

To begin with, you are suggested to download free trial of .NET PDF to Image SDK online. To test its superior PDF to JPG conversion functionality in C# application, you may firstly create a new console application and refer to the following C# programming sample codes.

PDF to JPG/JPEG Converting - C# Sample

By adding Visual C# sample code below to your .NET project, you will get perfect JPG/JPEG images from PDF file pages.

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

      // Load PDF document from local file.
      pdfDoc.LoadPDF("sample.pdf");

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

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

        // Save image with jpg file type.
        jpgImage.Save("output" + i + ".jpg", ImageFormat.Jpeg);
      }
    }
  }
}

As you see, the above C# programming example shows how to load a PDF file at local disk and convert it to JPG/JPEG image files. And now we will introduce you how to load a PDF from file stream and convert it to JPG/JPEG images with expected size using C# class code.

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

namespace PDFToJPG
{
  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 the width of output jpeg image.
      int width = pdf.GetPageWidth(0) / 2;

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

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

      // Save image to jpg format.
      jpg.Save("result.jpeg", ImageFormat.Jpeg);
    }
  }
}

convert pdf to jpg in c#

In addition to these C# PDF converting examples, we also provide detailed online guide for how to customize JPEG image size while converting from PDF document in C#.

pqScan SDK
.NET PDF to Image Software
Online Guide
.NET PDF to Image Converting
Conversion Type
Transform PDF to GIF in C# Transform PDF to TIFF in C# Transform PDF to Multi-page TIF in C# Transform PDF to Bitmap in C# Transform PDF to Bitmap in .NET Transform PDF to TIFF in .NET Transform PDF to PNG in .NET Transform PDF to PNG in VB.NET View All Image Types >>
This product has helped to make our project much easier. There is just so much to say about the excellence of it that words do not give it justice. One must see it in action to really appreciate the great things it can do. Isaac Herman