How to Start Convert PDF Work with PDF Modules PDF Document PDF Pages Text Image Graph & Path Annotation, Markup & Drawing Redaction Security Digital Signature Forms Watermark Bookmark Link File Attachment File Metadata Printing Work with Other SDKs Barcode read Barcode create OCR Twain

VB.NET PDF to PNG Library
How to convert PDF to PNG image files using VB.NET in Windows Forms, WPF application


Visual Basic .NET PDF to PNG Converter without Acrobat, open source library, such as itextsharp, pdfsharp, imagemagick.





In this VB.NET tutorial, you learn how to convert PDF page to jpg image using VB.NET in .NET Windows Forms, WPF application.

How to convert PDF file to JPG images using Visual Basic .NET?

  1. Download XDoc.PDF JPEG Converter VB.NET library
  2. Install VB library to convert PDF document to JPG images
  3. Step by Step Tutorial














PDF to PNG Image Options in VB.NET Code


With XDoc.PDF for VB.NET, you can easily convert single PDF file or mutliple PDF documents into PNG images using VB.NET. The converted PNG image options are applied in VB class "ImageOutputOption".


  1. Type: The converted image type should be ImageType.PNG

  2. Color: Output png image is Monochrome, Gray, Color.

  3. PngInterlance: True, create an Interlaced PNG; False, create a Non-interlaced PNG.
    Non-interlaced PNG encodes an image from start to finish; but Interlaced PNG encodes a whole image at low quality at beginning and then on each successive pass it encodes more of the detail, until the complete image has been processed.

  4. PngFilter: In PNG, a filter algorithm could be applied before compression which makes the image data for optimum compression.
    None: the scanline is transmitted unmodified.
    Sub: it transmits the difference between each byte and the value of the corresponding byte of the prior pixel.
    Up: it is just like the Sub filter except that the pixel immediately above the current pixel, rather than just to its left, is used as the predictor.
    Average: it uses the average of the two neighboring pixels (left and above) to predict the value of a pixel.
    Paeth: it computes a simple linear function of the 3 neighboring pixels (left, above, upper left), then chooses as predictor the neighboring pixel closest to the computed value.

  5. Zoom: Set zoom value to 2F. Use more pixels to render the page.

  6. Resolution: Set image resolution value in the PNG file.



Dim options As ImageOutputOption = New ImageOutputOption()
' Set output image type.
options.Type = ImageType.PNG
' Output image Is grayscale.
options.Color = ColorType.Gray
' Set interlaced flag to true.
options.PngInterlance = True
' Set filter type to SUB
options.PngFilter = FilterPNG.SUB
' Set zoom value to 2F. Use more pixels to render the page.
options.Zoom = 2.0F
' Set resolution value in the PNG file to 300 dpi.
options.Resolution = 300




How to convert PDF page to PNG image using VB.NET


The following steps and sample VB.NET code will show how to convert a PDF page to PNG image in vb.net code.

  1. Define a ImageOutputOption object with PNG image options
  2. Define a new PDFDocument with an existing PDF file loaded
  3. Get a PDFPage object from the first page of the PDF document
  4. Call PDFPage.ConvertToImage() to convert PDF page to a PNG image file with image options applied.


Dim inputFilePath As String = "C:\1.pdf"
Dim outputFilePath As String = "C:\output.png"

Dim options As ImageOutputOption = New ImageOutputOption()
' Set output image type.
options.Type = ImageType.PNG
' Output image Is grayscale.
options.Color = ColorType.Gray
' Set interlaced flag to true.
options.PngInterlance = True
' Set filter type to SUB
options.PngFilter = FilterPNG.SUB
' Set zoom value to 2F. Use more pixels to render the page.
options.Zoom = 2.0F
' Set resolution value in the PNG file to 300 dpi.
options.Resolution = 300

' Open file And get the target page
Dim doc As PDFDocument = New PDFDocument(inputFilePath)
Dim page As PDFPage = doc.GetPage(0)
' Convert page to a PNG image
page.ConvertToImage(options, outputFilePath)