PDF to GIF - pqScan.com
C# PDF to GIF Conversion Use Free C# Demo Code to Convert PDF into GIF Image Files in C# Program Online Demo Download Trial Purchase Now

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

back to home  >  .NET PDF to Image SDK  >  How to Convert PDF to Image in .NET  >  Convert PDF Document to GIF Image

In this article, we will introduce you how to use pqScan PDF to Image Converting Library SDK in C# programming application. Please bear in mind that we only give simple samples for performing basic PDF document to GIF image conversion. If you need to use all converting functions, you may see all supported properties and APIs from .NET PDF to GIF converting overview. Do contact us if you have any request, we are pleased to help.

  • Open Visual Studio to create a C# console project;
  • Obtain pqScan .NET PDF to Image SDK trial via download button above;
  • Unzip to find a suitable PQScan.PDFToImage.dll for your application;
  • Add required DLL library to C# project as reference;
  • Use free sample code below for rapid PDF file to GIF image conversion;

PDF to GIF Conversion - How to in C#

The following C# code gives you an example of rendering and converting PDF to gif image using pqScan PDFToImage SDK.

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

namespace PDF2GIF
{
  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 its page count.
      int count = pdfDoc.PageCount;

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

        // Save image as gif image format.
        gifImage.Save("output" + i + ".gif", ImageFormat.Gif);
      }
    }
  }
}

In the following C# programming tutorial, you will see how to perform the feature of turning PDF file to Gif image with a target size in C# .NET application.

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

namespace PDFToGIF
{
  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 a target width for gif image.
      int width = pdf.GetPageWidth(0) / 2;

      // Set a target height for gif image.
      int height = pdf.GetPageHeight(0) / 2;

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

      // Save image to gif format.
      gif.Save("result.gif", ImageFormat.Gif);
    }
  }
}

convert pdf to gif in c#

Here's a useful online guide that you may read, C#.NET guide: how to set output image converted from PDF, which describes how to customize GIF image size and quality by changing DPI, as well as resetting its width and height.

pqScan SDK
.NET PDF to Image Software
Online Guide
.NET PDF to Image Converting
Conversion Type
ASP.NET: Change PDF to TIFF .NET: Change PDF to JPEG .NET: Change PDF to PNG C#: Change PDF to PNG C#: Change PDF to Multiple Pages TIF C#: Change PDF to JPEG VB.NET: Change PDF to BMP VB.NET: Change PDF to Multi-page TIFF View All Image Types >>
I'd like to say this is a very powerful and easy to use tool. The functionality of it is really great. It saves me quite a bit of time. Another reason that prompts me to by your product is that the price is cost-effective compared to other providers. Ivan Melendez