Converting Images to PDF Documents with PDFium VCL in Delphi

Converting images to PDF is a common requirement for document management, archiving, and sharing. The Image to PDF demo shows how to create multi-page PDF documents from a collection of images using PDFium VCL.

Overview

This demo allows users to select multiple images, preview them, reorder if needed, and convert them into a single PDF document. Each image becomes a page in the PDF, properly scaled and centered.

Key Features

  • Multiple Image Support – Add multiple images at once
  • Format Support – JPEG, PNG, BMP, GIF, and TIFF images
  • Image Preview – Preview images before conversion
  • Automatic Page Sizing – Portrait or landscape based on image orientation
  • Smart Scaling – Images are scaled to fit the page with margins
  • Image Information – Original size and scale factor displayed on each page

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.

Creating PDFs from Images

The core conversion process:

Adding Images to the List

Using AddPicture Method

The AddPicture method accepts a TPicture object, which supports various image formats:

Adding JPEG Images Directly

For JPEG images, you can use the optimized AddJpegImage method:

Previewing Selected Images

Removing and Reordering Images

Setting Up the Dialog

Use Cases

  • Photo Albums – Create PDF albums from digital photos
  • Document Scanning – Combine scanned page images into a single PDF
  • Portfolio Creation – Build portfolio PDFs from artwork images
  • Archiving – Convert image collections to PDFs for long-term storage
  • Report Generation – Include screenshots and diagrams in PDF reports

Conclusion

The Image to PDF demo shows how PDFium VCL makes it easy to create professional PDF documents from images. With automatic page sizing, smart scaling, and support for multiple image formats, you can build powerful image-to-PDF conversion tools.

The AddPicture method handles the complexity of embedding images into PDF pages, while you focus on the user interface and workflow of your application.

Try PDFium VCL Component from loslab.com and start creating PDFs from images today.