We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to extract images from a PDF file?

Platform: WinForms |
Control: PDF |
Published Date: August 13, 2018 |
Last Revised Date: May 3, 2019

Syncfusion Essential PDF is the .NET PDF library used to create, read, and edit PDF documents. Using this library, you can extract images from a page or an entire PDF document.

Steps to extract images in PDF programmatically:

  1. Create a new C# Console application project. Create a console application in visual studio
  2. Install the Syncfusion.Pdf.WinForms  NuGet package as reference to your .NET Framework applications from NuGet.org. Install nuget packages
  3. Include the following namespaces in the Program.cs file.

C#

using Syncfusion.Pdf;
using Syncfusion.Pdf.Parsing;
using System.Drawing;

 

VB.NET

Imports Syncfusion.Pdf
Imports Syncfusion.Pdf.Parsing
Imports System.Drawing

 

  1. Use the ExtractImages() method that allows you to extract images from a particular page or an entire PDF document.
    //Extract images from first page
    Image[] extractedImages = pageBase.ExtractImages();
    

 

  1. The following C# and VB.NET code snippet shows how to extract images from a particular page or an entire PDF document.

C#

//Load an existing PDF
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(DataPathBase + "sample.pdf");
 
//Load first page
PdfPageBase pageBase = loadedDocument.Pages[0];
 
//Extract images from first page
Image[] extractedImages = pageBase.ExtractImages();
 
//close the document
loadedDocument.Close(true);

 

VB.NET

'Load an existing PDF
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument((DataPathBase + "sample.pdf"))
 
'Load first page
Dim pageBase As PdfPageBase = loadedDocument.Pages(0)
 
'Extract images from first page
Dim extractedImages() As Image = pageBase.ExtractImages
 
'close the document
loadedDocument.Close(True)

  

A complete working sample can be downloaded from Extract-Images-From-PDF-File.zip.

The input PDF document is as follows. Input PDF file of extact images

By executing the program, you will get the list of extracted images from the first page of the PDF document.

Take a moment to peruse the documentation, where you can find the image information and text extraction from PDF document with Essential PDF, and brief details about OCR processing , and merge document with code examples.

Refer here to explore the rich set of Syncfusion Essential PDF features.

An online sample link to extract images from PDF document

Note:

Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.

 

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon