PDF to GIF - pqScan.com
VB.NET PDF to GIF Converting PDF into GIF Image Files in Visual Basic.NET Online Demo Download Trial Purchase Now

How to Convert PDF to GIF in VB.NET?

back to home  >  PDF to Image SDK  >  How to Convert PDF to Image  >  Convert PDF to GIF

The pqScan PDF to Image for .NET is an easy to use .NET library to quickly take your PDF document and convert it to a pixel-based format(an image format, such as GIF image). If you do so, you could use the output image for other purposes where PDF document was not fit for. With a Free Evaluation Edition to try, why not start using .NET PDF to Image now.

PDF to GIF -- Visual Basic sample

The following example demonstrates how to load a PDF document and render it into a GIF image file. Converting PDF pages to GIF can be done in just a few simple lines of VB.NET code.

Imports System.Drawing
Imports System.Drawing.Imaging
Imports PQScan.PDFToImage

Namespace PDF2GIF
  Class Program
    Private Shared Sub Main(args As String())
      ' Create an instance of PQScan.PDFToImage.PDFDocument object.
      Dim pdfDoc As New PDFDocument()

      ' Take PDF document.
      pdfDoc.LoadPDF("sample.pdf")

      'Get total page count.
      Dim count As Integer = pdfDoc.PageCount

      For i As Integer = 0 To count - 1
        'Convert page to image
        Dim gifImage As Bitmap = pdfDoc.ToImage(i)
        'Save image with gif file type
        gifImage.Save("output" & i & ".gif", ImageFormat.Gif)
      Next
    End Sub
  End Class
End Namespace

Below VB.Net sample codes introduce you how to draw Gif image from PDF stream, and resize the output Gif image.

Imports System.IO
Imports System.Drawing
Imports System.Drawing.Imaging
Imports PQScan.PDFToImage

Namespace PDFToGIF
  Class Program
    Private Shared Sub Main(args As String())
      ' Generate a new PDFDocument instance from PQScan.PDFToImage.
      Dim pdf As New PDFDocument()

      ' Open PDF document to file stream
      Dim stream As New FileStream("sample.pdf", FileMode.Open)

      ' Load message from PDF document stream.
      pdf.LoadPDF(stream)

      ' Specify gif image width from PDF page
      Dim width As Integer = pdf.GetPageWidth(0) / 2
      ' Specify gif image height from PDF page
      Dim height As Integer = pdf.GetPageHeight(0) / 2

      'Convert PDF first page to image with the customized size
      Dim gif As Bitmap = pdf.ToImage(0, width, height)
      'Save image to gif format
      gif.Save("result.gif", ImageFormat.Gif)
    End Sub
  End Class
End Namespace

convert pdf to gif in vb.net

There is another article shows more information of customizing the image size and changing image quality, if you want to, it may be helpful.

pqScan SDK
.NET DLL for PDF to Image
Online Guide
.NET Guide for PDF to Image
Conversion Type
C#: Turn PDF to Bitmap C#: Turn PDF to TIF .NET: Turn PDF to JPG .NET: Turn PDF to TIFF ASP.NET: Turn PDF to PNG VB.NET: Turn PDF to PNG VB.NET: Turn PDF to GIF VB.NET: Turn PDF to TIFF View All Image Types >>
Thank you for the detailed response. It is much appreciated! Now, everything goes well in my project! I would like to move onto to make an order for your .NET PDF to Image SDK! Harriet Peplin