XDoc.PDF
Features
Tech Specs
How-to C#
How-to VB.NET
Pricing
C# PDF: How to PDF Create PDF Export File and Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print WPF Viewer & Editor Work with Other SDKs Barcode Read Barcode Create OCR Twain
Image: Extract Image from PDF
  |  
Home ›› XDoc.PDF ›› C# PDF: Extract PDF Image

C#.NET PDF SDK - Extract Image from PDF Document in C#.NET


A .NET Library Support PDF Image Extraction from a Page, a Region on a Page, and PDF Document in C#




Best C#.NET library for extracting image from adobe PDF page in Visual Studio .NET framework project


Provide trial SDK components for quick integration in Visual C#.NET WinForms and ASP.NET project for PDF image extraction


Free C# source code for extracting image from specified PDF page position in .NET class


Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint


Extract various types of image from PDF file, like XObject Image, XObject Form, Inline Image, etc


Get JPG, JPEG and other high quality image files from PDF document


Able to extract vector images from PDF in .NET console application


Extract all images from whole PDF or a specified PDF page


Capture image from whole PDF based on special characteristics


Scan image to PDF, tiff and various image formats


Get image information, such as its location, zonal information, metadata, and so on


C# users are able to extract image from PDF document page and get image information for indexing and accessing.






C# extract images from whole pdf document


Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:

       

       If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.

       

       If using x86, the platform target should be x86.




        #region extract images from whole pdf document
        internal static void extractImagesFromPdfFile()
        {
            String inputFilePath = @"C:\demo.pdf";
            // Open a document.
            PDFDocument doc = new PDFDocument(inputFilePath);

            // Extract all images in the document.
            List<PDFImage> allImages = PDFImageHandler.ExtractImages(doc);
        }
        #endregion




C# extract images from specified PDF page





        #region extract images from one pdf page
        internal static void extractImagesFromPdfPage()
        {
            String inputFilePath = @"C:\demo.pdf";
            // Open a document.
            PDFDocument doc = new PDFDocument(inputFilePath);
            PDFPage page = (PDFPage)doc.GetPage(0);

            // Extract all images on one pdf page.
            List<PDFImage> allImages = PDFImageHandler.ExtractImages(page);
        }
        #endregion




C# read the image from specified position (coordinates) inside pdf document





        #region read the image from specified position (coordinates) inside pdf document
        internal static void extractImagesFromSpecifiedPosition()
        {
            String inputFilePath = @"C:\demo.pdf";
            // Open a document.
            PDFDocument doc = new PDFDocument(inputFilePath);

            // Get page 3 from the document.
            PDFPage page = (PDFPage)doc.GetPage(3);

            // Select image by the point (50F, 100F).
            PDFImage img = PDFImageHandler.SelectImage(page, new PointF(50F, 100F));

            // ...
        }
        #endregion




.NET Class Namespace Required



In order to run the sample code, the following steps would be necessary.


Add necessary references:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XImage.Raster.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XDoc.PDF.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.PDF;





public static List<PDFImage> ExtractImages(PDFDocument doc)

Description:
     Extract all images in a PDF document.

Parameters:

Return:
     A list of image objects, null if failed.



public static List<Bitmap> ExtractOriginalImages(PDFDocument doc)

Description:
     Search specified string from specified page.

Parameters:

Return:
     A list of bitmap objects, null if failed.



public static List<PDFImage> ExtractImages(PDFPage page)

Description:
     Extract all images in a PDF document.

Parameters:

Return:
     A list of image objects, null if failed.



public static List<Bitmap> ExtractOriginalImages(PDFPage page)

Description:
     Search specified string from specified page.

Parameters:

Return:
     A list of bitmap objects, null if failed.