Creating a Multi-Page PDF Viewer with Continuous Scrolling in Delphi

This tutorial explores the Multi-Page Viewer demo, which extends the basic PDF viewer with continuous scrolling capabilities. This viewing mode is similar to how modern PDF readers like Adobe Acrobat display documents, allowing users to scroll through all pages seamlessly.

Overview

The Multi-Page Viewer demo showcases advanced viewing modes in PDFium VCL, including single-page continuous scrolling and dual-page continuous scrolling (book mode). These features are essential for creating a professional PDF reading experience.

Display Modes

PDFium VCL supports multiple display modes through the DisplayMode property:

Key Features

  • Continuous Scrolling – Scroll through all pages without page-by-page navigation
  • Dual-Page Mode – View two pages side-by-side like a physical book
  • Text Selection Across Pages – Select and copy text spanning multiple pages
  • Bookmark Navigation – Jump to bookmarked sections instantly
  • Search with Highlighting – Find and highlight text across the document
  • Keyboard Navigation – Arrow keys, Page Up/Down, Home/End support
  • Optimized Performance – Renders only visible pages for smooth scrolling

PDFium DLL Requirements

Before running any PDFium VCL application, you must install the PDFium DLL files. The DLLs are located in the DLLs folder:

  • pdfium32.dll / pdfium64.dll – Standard versions for most applications
  • pdfium32v8.dll / pdfium64v8.dll – Extended versions with V8 JavaScript engine

Installation: Run PDFiumVCL\DLLs\CopyDlls.bat as Administrator to copy DLLs to Windows system directories. On 64-bit Windows, 32-bit DLLs go to SysWOW64 and 64-bit DLLs go to System32.

Setting Up the Component

The demo implements a sophisticated text selection system:

Character Index Detection

For precise text selection, the demo uses zoom-aware tolerance for character detection:

Highlighting Selected Text

The demo draws selection highlights in the OnPaint event:

Copy Selected Text to Clipboard

Search Functionality

Implement text search with highlighting:

Page Change Event

Handle page changes to update UI elements:

Keyboard Navigation

The demo handles keyboard shortcuts for navigation:

Dual-Page Navigation

When in dual-page mode, navigate by two pages at a time:

Conclusion

The Multi-Page Viewer demo shows how to build a feature-complete PDF reader with continuous scrolling, text selection, and search functionality. These are the features users expect from modern PDF viewing applications.

PDFium VCL handles the complex rendering and text extraction, while you focus on the user interface and application-specific features. The result is a smooth, responsive PDF viewing experience that rivals commercial PDF readers.

Get PDFium VCL Component at loslab.com and start building professional PDF applications in Delphi today.