Winnovative Software Logo

 HTML to PDF Converter - Excel Library - ASP.NET Charts - RTF to PDF Converter
 PDF Merge and Split - PDF Security - PDF Viewers - PDF to Text - Images Extractor

 
Skip Navigation Links
 

PDF Images Extractor for .NET

The Winnovative PDF Images Extractor can be used in any type of .NET application to extract images from a PDF document. The integration with existing .NET applications is extremely easy and no installation is necessary in order to run the converter. The downloaded archive contains the assembly for .NETand a ready to use sample console application. The full C# source code for the sample application is available in the Samples folder. The sample application can be built with Visual Studio 2010 or 2012. The extractor produces .NET Bitmap objects during conversion that you can save in image files or use for further processing.

Features

PDF Split for .NET Box
.NET development library and C# samples
Extract images from PDF streams or PDF files
Extract images in file or in internal memory
Specify the extracted image format (bmp, png, jpeg, etc)
Does not require Adobe Reader or other third party tools
Generate ImageExtracted events after each image extraction
The ImageExtracted event handler receives the extracted Bitmap object
The ImageExtracted event handler receives the PDF page number
Specify the range of pages to be extracted
Extract images from password protected PDF documents


Code Sample for PDF Images Extraction

The code below was taken from the command line sample available for download in the PDF Images Extractor archive. In this sample an instance of the PdfImgExtract class is constructed and the images extractor object properties are set based on the command line arguments. Then the ExtractImages method is called to extract the images from the source PDF document to disk. The ImageExtractedEvent handler will simply display a brief information about the extracted image like the PDF page number from where the image was extracted and the extracted image size in pixels.
        public void PdfImgExtractSample()
        {
            // create pdf images extractor object
            PdfImgExtract pdfImgExtractor = new PdfImgExtract();

            // set converter options
            pdfImgExtractor.UserPassword = userPassword; //PDF open password
            pdfImgExtractor.ExtractImageFormat = imgFormat; // output image format
            pdfImgExtractor.StartPageNumber = 1; //extract starting from first page
            pdfImgExtractor.EndPageNumber = 0; //extract from all pages
            pdfImgExtractor.ExtractPath = "."; //extract to working directory
            pdfImgExtractor.ExtractPrefix = "pdfimage_"; //image name prefix

            // notify when a new image was extracted
            pdfImgExtractor.ImageExtractedEvent += 
                new ImageExtractedEventHandler(pdfImgExtractor_ImageExtractedEvent);

            pdfImgExtractor.ExtractImages(srcPdfFile, true);
        }

        /// <summary>
        /// ImageExtractedEvent handler called each time a new image is extracted
        /// </summary>
        /// <param name="args">The event handler argument</param>
        static void pdfImgExtractor_ImageExtractedEvent(ImageExtractedEventArgs args)
        {
            System.Drawing.Bitmap extractedBitmap = args.ExtractedBitmap;
            int pageNumber = args.PageNumber;
            Console.WriteLine(String.Format("Page {0} - extracted image size:
                {1}x{2}", 
                pageNumber, extractedBitmap.Width, extractedBitmap.Height));
        }
 

Licensing

 
The LicenseKey property of the PdfImgExtract class should be set with the string you have received after the product purchase.