Extracting Images from PDF Documents with PDFium VCL in Delphi

PDF documents often contain valuable images—photographs, diagrams, charts, and graphics. The Extract Images demo shows how to extract all embedded images from a PDF document using PDFium VCL, saving them in optimal formats based on their characteristics.

Overview

This demo extracts embedded images (bitmaps) from PDF pages and saves them as separate image files. It includes image preview, format detection, and batch extraction with progress tracking.

Key Features

  • Extract All Images – Extract every embedded image from the PDF
  • Page Range Selection – Extract from specific pages only
  • Smart Format Detection – Automatically choose JPEG, PNG, or BMP based on image characteristics
  • Image Preview – Preview extracted images before saving
  • Detailed Information – View dimensions, format, and file size
  • Batch Processing – Extract multiple images with progress tracking

PDFium DLL Requirements

Before running any PDFium VCL application, ensure the PDFium DLL files are installed:

  • pdfium32.dll / pdfium64.dll – Standard versions (~5-6 MB)
  • pdfium32v8.dll / pdfium64v8.dll – With V8 JavaScript engine (~23-27 MB)

Installation: Run PDFiumVCL\DLLs\CopyDlls.bat as Administrator to automatically copy the DLLs to Windows system directories.

Basic Image Extraction

Access embedded images through the Bitmap and BitmapCount properties:

Complete Extraction with Format Detection

The demo implements intelligent format selection:

Intelligent Format Detection

Choose the optimal format based on image characteristics:

Saving in Optimal Format

Using TPdfImage for Raw Image Data

For advanced use cases, access raw image data:

Displaying Image Information

Page Range Parsing

Open Extracted Images Folder

Use Cases

  • Digital Asset Extraction – Extract photos and graphics from marketing materials
  • Document Conversion – Prepare images for web or other formats
  • Archive Processing – Extract images from scanned document archives
  • Content Analysis – Extract images for machine learning or analysis

Conclusion

The Extract Images demo shows how easy it is to extract embedded images from PDF documents with PDFium VCL. The component handles the complex PDF parsing while you focus on how to use the extracted images in your application.

Combined with intelligent format detection, you can build professional image extraction tools that produce optimized output for any use case.

Explore PDFium Component at loslab.com and unlock the content in your PDF documents.