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

How to Convert PDF to JPG/JPEG in VB.NET?

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

In this article, we will introduce you how to use PDF To Image SDK in Visual Basic.NET. Please keep in mind following example, it's really an easy and convenient way to turn PDF pages into JPEG images. During the using, if you encounter any problem, please contact us as soon as possible. We will solve it for you at the first times.

PDF to JPG/JPEG -- Visual Basic sample

Below is a sample to guide you how to convert PDF to JPG/JPEG image in VB .NET.

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

Namespace PDF2JPG
  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
        BitmapjpgImage = pdfDoc.ToImage(i)
        'Save image with jpg file type
        jpgImage.Save("output" & i & ".jpg", ImageFormat.Jpeg)
      Next
    End Sub
  End Class
End Namespace

Besides load local PDF, loading PDF stream is supported. Following example shows how to convert PDF first page to Jpeg image with wanted size using Visual Basic.NET code.

Imports System.IO
Imports System.Drawing
Imports System.Drawing.Imaging
Imports PQScan.PDFToImage
Namespace PDFToJPG
  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 jpg image width from PDF page
      Dim width As Integer = pdf.GetPageWidth(0) / 2
      ' Specify jpg image height from PDF page
      Dim height As Integer = pdf.GetPageHeight(0) / 2

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

convert pdf to jpg in vb.net

Another article, guiding to specify the image size using DPI property is supported, please see "How to customize images from PDF pages using vb.net". Do contact us if you have any other questions, pqScan is always ready to help.

pqScan SDK
.NET DLL for PDF to Image
Online Guide
.NET Guide for PDF to Image
Conversion Type
Change PDF to GIF in VB.NET Change PDF to TIFF in VB.NET Change PDF to Multi-page TIF in VB.NET Change PDF to BMP in C# Change PDF to GIF in C# Change PDF to TIF in .NET Change PDF to TIF in ASP.NET Change PDF to GIF in ASP.NET View All Image Types >>
After much searching and endless comparison, we found your .NET package that truly served our needs. We really appreciate your personalized service and ongoing support. Harlan Maas