PDF Images Extractor for .NET
The ExpertPdf PDF Images Extractor extracts the images from a PDF document in any type of .NET
application. It produces .NET Bitmap objects that you can save in image files or use for
further processing.
Extract from a file or a stream, choose the pages, save the images to a folder in the format you want, or handle each image in an event that also gives its page number. It works with password protected documents and needs no Adobe Reader or other third party tools.
Everything the Images Extractor does.
Grouped by what you extract from the PDF document and how the images come back to your application.
What you extract from.
A PDF file or stream, all the pages or a range of pages, password protected documents too.
From a file or a stream
Pass the path of a PDF file, or a Stream such as a FileStream or a MemoryStream.
Choose the pages
Extract only the images of a range of pages with StartPageNumber and EndPageNumber. By default all the pages are used.
The page of each image
Every extracted image comes with the number of the PDF page it was found on.
Password protected PDFs
Extract images from password protected documents with the UserPassword property.
What you get back.
.NET Bitmap objects in an event, image files in a folder, or both.
An event for each image
The ImageExtractedEvent event is raised after each image is extracted, with the Bitmap and its page number.
Save to a folder
Save the images in the ExtractPath folder, with file names that start with ExtractPrefix.
Choose the image format
Set the format of the saved images, such as BMP, PNG or JPEG, with ExtractImageFormat.
In memory only
Keep the images in memory and handle them in the event, without writing anything to disk.
A list in memory
ExtractImagesToMemory returns the images as a list, each with its page number and its index in the document and on the page.
Skip small images
Leave out icons and bullets with MinimumWidth and MinimumHeight.
Skip duplicates
With SkipDuplicateImages, an image that repeats on every page, such as a logo, is extracted only once.
No third party tools
No other PDF software or third party tools are required.
A PDF, in its image parts.
The PdfImgExtract class: save every image of a page range to a folder, or handle each image in the ImageExtractedEvent event.
using System.Drawing.Imaging; using ExpertPdf; var extractor = new PdfImgExtract(); extractor.ExtractPath = "output"; extractor.ExtractPrefix = "brochure"; extractor.ExtractImageFormat = ImageFormat.Png; extractor.StartPageNumber = 1; extractor.EndPageNumber = 10; // true: save every extracted image in the ExtractPath folder extractor.ExtractImages("brochure.pdf", true);
The download includes a ready-to-use sample console application with its full C# source code.
Install from NuGet with dotnet add package ExpertPdf.PdfImgExtract, or download it.
Image extraction questions, answered.
Common questions about what comes out, in which format, and from which pages.
What does the extractor produce?
Bitmap objects. After each image is extracted, the ImageExtractedEvent event is raised. Its argument has the image, ExtractedBitmap, and the number of the page it came from, PageNumber. You can save the bitmap, or use it for further processing.Can it save the images to files?
ExtractImages with its second argument set to true, and the images are saved in the ExtractPath folder, in the format set by ExtractImageFormat, with file names that start with ExtractPrefix. With false, nothing is written to disk and you handle each image in the event.In which image formats can the images be saved?
ExtractImageFormat to a .NET System.Drawing.Imaging.ImageFormat, for example BMP, PNG or JPEG.Can I extract the images of only some pages?
StartPageNumber and EndPageNumber properties. By default the images of all the pages are extracted. GetPageCount returns the number of pages of a document.Can it skip small or repeated images?
MinimumWidth and MinimumHeight leave out images smaller than a size in pixels, and SkipDuplicateImages extracts an image that appears several times, such as a logo on every page, only once.Can it extract images from password protected PDF documents?
UserPassword property to the password that opens the document.Does it need Adobe Reader or other tools?
ExpertPdf.PdfImgExtract package from NuGet, or reference the assembly from the download.Which .NET versions and operating systems are supported?
ExpertPdf.PdfImgExtract.x64, is also available for applications that run as x64 processes.Is there a free version I can try?
Extract images from PDF documents in .NET.
Download the free evaluation with the C# sample console application. When you are ready, license it on the pricing page.