1616 <img src="https://img.shields.io/badge/Delphi-12%2B-red.svg" alt="Delphi Version">
1717 </a >
1818 <img src =" https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Android%20%7C%20iOS-lightgrey.svg " alt =" Platforms " >
19- <img src =" https://img.shields.io/badge/framework-FireMonkey -orange.svg " alt =" Framework " >
19+ <img src =" https://img.shields.io/badge/framework-FMX%20%7C%20VCL -orange.svg " alt =" Framework " >
2020 <a href =" https://pdfium.googlesource.com/pdfium/ " >
2121 <img src="https://img.shields.io/badge/PDFium-Google-4285F4.svg" alt="PDFium">
2222 </a >
3737
3838** DX Pdfium4D** is a comprehensive Delphi wrapper for Google's PDFium library, providing object-oriented classes for PDF document handling in cross-platform Delphi applications.
3939
40- The project includes ** DX PDF Viewer** , a minimalistic cross-platform PDF viewer application built with FireMonkey (FMX), which serves as a practical demonstration of the wrapper's capabilities and showcases modern Delphi development practices.
40+ The project includes ** DX PDF Viewer** demo applications for both ** FireMonkey (FMX)** and ** VCL ** , which serve as practical demonstrations of the wrapper's capabilities and showcase modern Delphi development practices.
4141
4242### Why DX Pdfium4D?
4343
4444- ✅ ** Type-safe, object-oriented API** - No more dealing with raw C pointers
45- - ✅ ** Automatic resource management** - Reference counting prevents memory leaks
45+ - ✅ ** Automatic resource management** - Destructors handle PDFium cleanup automatically
4646- ✅ ** Cross-platform** - Windows, macOS, Android, iOS
47+ - ✅ ** FMX and VCL support** - Works with both FireMonkey and VCL frameworks
4748- ✅ ** Well-documented** - Comprehensive documentation and examples
48- - ✅ ** Production-ready** - Includes unit tests and example application
49+ - ✅ ** Production-ready** - Includes unit tests and demo applications
4950- ✅ ** MIT Licensed** - Free for commercial and open-source projects
5051
5152---
@@ -75,7 +76,7 @@ The project includes **DX PDF Viewer**, a minimalistic cross-platform PDF viewer
7576
7677🔧 ** Object-Oriented API**
7778- High-level Delphi classes wrapping PDFium C-API
78- - Automatic resource management with reference counting
79+ - Automatic PDFium resource cleanup in destructors
7980- Type-safe, exception-based error handling
8081
8182📄 ** PDF Document Support**
@@ -88,19 +89,25 @@ The project includes **DX PDF Viewer**, a minimalistic cross-platform PDF viewer
8889- High-quality bitmap rendering
8990- Configurable DPI support
9091- Platform-independent rendering
92+ - Separate renderers for FMX and VCL
9193
9294🌍 ** Cross-Platform**
93- - Windows (Win32, Win64)
94- - macOS (Intel, Apple Silicon)
95- - Android
96- - iOS
95+ - Windows (Win32, Win64) - FMX and VCL
96+ - macOS (Intel, Apple Silicon) - FMX
97+ - Android - FMX
98+ - iOS - FMX
9799
98- ### DX PDF Viewer Application
100+ ### DX PDF Viewer Applications
101+
102+ ✨ ** Two Implementations**
103+ - ** FMX Viewer** - Cross-platform (Windows, macOS, Android, iOS)
104+ - ** VCL Viewer** - Windows-only with native Windows controls
99105
100106✨ ** Minimalistic Design**
101107- Clean, distraction-free interface
102108- Focus on content, not chrome
103- - Modern Material Design-inspired UI
109+ - Modern Material Design-inspired UI (FMX)
110+ - Native Windows look and feel (VCL)
104111
105112🎯 ** User-Friendly**
106113- Drag & Drop PDF files to open
@@ -112,16 +119,19 @@ The project includes **DX PDF Viewer**, a minimalistic cross-platform PDF viewer
112119- Background rendering for smooth UI
113120- Efficient memory management
114121- Fast page switching
122+ - Proper aspect ratio preservation
123+ - Centered display with visual feedback
115124
116125---
117126
118127## Getting Started
119128
120129### Prerequisites
121130
122- - ** Delphi 12 or later** (tested with Delphi 12.2 Athens)
123- - Minimum: Delphi XE2 (for FireMonkey support)
124- - Recommended: Delphi 10.x or later for best cross-platform support
131+ - ** Delphi 12 or 13** (recommended and tested)
132+ - Tested with Delphi 12.3 Athens and Delphi 13 Florence
133+ - Should work with Delphi 10.0 or later (not tested, no guarantee)
134+ - Minimum: Delphi 10.0 for FMX and VCL support
125135- ** PDFium Library** (included in ` lib/pdfium-bin ` )
126136
127137### Installation
@@ -144,9 +154,10 @@ Download the latest release from the [Releases](https://github.com/omonien/DX-Pd
1441541 . ** Add the wrapper units to your project:**
145155 ``` pascal
146156 uses
147- DX.Pdf.API, // Low-level PDFium C-API bindings
148- DX.Pdf.Document, // High-level document/page classes
149- DX.Pdf.Viewer.FMX; // (Optional) FMX visual component
157+ DX.Pdf.API, // Low-level PDFium C-API bindings
158+ DX.Pdf.Document, // High-level document/page classes
159+ DX.Pdf.Viewer.FMX, // (Optional) FMX visual component
160+ DX.Pdf.Viewer.VCL; // (Optional) VCL visual component
150161 ```
151162
1521632 . ** Include PDFium library:**
@@ -180,23 +191,29 @@ Download the latest release from the [Releases](https://github.com/omonien/DX-Pd
1801914 . ** See the full documentation:**
181192 - 📖 ** [ Using the DX.Pdf Wrapper Classes] ( USING_DX_PDF.md ) **
182193
183- #### Building the DX PDF Viewer Example
194+ #### Building the DX PDF Viewer Examples
184195
185- 1 . ** Open the project:**
186- - Open ` src/PdfViewer/DX.PdfViewer.dproj ` in Delphi IDE
196+ ** FMX Viewer (Cross-Platform):**
197+ 1 . Open ` src/PdfViewer/DX.PdfViewer.dproj ` in Delphi IDE
198+ 2 . Press ** F9** or select ** Run → Run**
199+ 3 . The PDFium DLL will be automatically copied to the output directory
187200
188- 2 . ** Build and run:**
189- - Press ** F9** or select ** Run → Run**
190- - The PDFium DLL will be automatically copied to the output directory
201+ ** VCL Viewer (Windows):**
202+ 1 . Open ` src/PdfViewerVCL/DX.PdfViewerVCL.dproj ` in Delphi IDE
203+ 2 . Press ** F9** or select ** Run → Run**
204+ 3 . The PDFium DLL will be automatically copied to the output directory
191205
192- 3 . ** Run from command line:**
193- ``` bash
194- # Windows
195- src\P dfViewer\W in32\D ebug\D X.PdfViewer.exe path\t o\d ocument.pdf
206+ ** Run from command line:**
207+ ``` bash
208+ # FMX Viewer - Windows
209+ src\P dfViewer\W in32\D ebug\D X.PdfViewer.exe path\t o\d ocument.pdf
196210
197- # macOS
198- ./DX.PdfViewer document.pdf
199- ```
211+ # FMX Viewer - macOS
212+ ./DX.PdfViewer document.pdf
213+
214+ # VCL Viewer - Windows
215+ src\P dfViewerVCL\W in32\D ebug\D X.PdfViewerVCL.exe path\t o\d ocument.pdf
216+ ```
200217
201218---
202219
@@ -212,15 +229,19 @@ The wrapper provides three main abstraction layers:
212229
2132301 . ** ` DX.Pdf.API ` ** - Low-level PDFium C-API bindings
2142312 . ** ` DX.Pdf.Document ` ** - High-level object-oriented wrapper
215- 3 . ** ` DX.Pdf.Viewer.FMX ` ** - Visual FMX component
232+ 3 . ** ` DX.Pdf.Viewer.Core ` ** - Shared viewer logic (platform-independent)
233+ 4 . ** ` DX.Pdf.Viewer.FMX ` ** - FMX visual component
234+ 5 . ** ` DX.Pdf.Viewer.VCL ` ** - VCL visual component
235+ 6 . ** ` DX.Pdf.Renderer.FMX ` ** - FMX-specific rendering
236+ 7 . ** ` DX.Pdf.Renderer.VCL ` ** - VCL-specific rendering
216237
217238---
218239
219240## Examples
220241
221- ### DX PDF Viewer Application
242+ ### DX PDF Viewer Demo Applications
222243
223- The included ** DX PDF Viewer** application demonstrates the wrapper's capabilities.
244+ The included ** DX PDF Viewer** applications (FMX and VCL) demonstrate the wrapper's capabilities.
224245
225246#### Features
226247
@@ -266,28 +287,37 @@ The status bar displays:
266287
267288```
268289DX-Pdfium4D/
269- ├── src/ # Source code
270- │ ├── DX.Pdf.API.pas # Low-level PDFium C-API bindings
271- │ ├── DX.Pdf.Document.pas # High-level document/page classes
272- │ ├── DX.Pdf.Viewer.FMX.pas # FMX visual component
273- │ ├── PdfViewer/ # Main application
290+ ├── src/ # Source code
291+ │ ├── DX.Pdf.API.pas # Low-level PDFium C-API bindings
292+ │ ├── DX.Pdf.Document.pas # High-level document/page classes
293+ │ ├── DX.Pdf.Viewer.Core.pas # Shared viewer logic
294+ │ ├── DX.Pdf.Viewer.FMX.pas # FMX visual component
295+ │ ├── DX.Pdf.Viewer.VCL.pas # VCL visual component
296+ │ ├── DX.Pdf.Renderer.FMX.pas # FMX rendering
297+ │ ├── DX.Pdf.Renderer.VCL.pas # VCL rendering
298+ │ ├── PdfViewer/ # FMX demo application
274299│ │ ├── DX.PdfViewer.dpr # Main program file
275300│ │ ├── DX.PdfViewer.dproj # Delphi project file
276- │ │ ├── Main.Form.pas # Main application form
277- │ │ └── Main.Form.fmx # Form layout
278- │ └── tests/ # Unit tests
301+ │ │ ├── Main.Form.pas # Main application form
302+ │ │ └── Main.Form.fmx # Form layout
303+ │ ├── PdfViewerVCL/ # VCL demo application
304+ │ │ ├── DX.PdfViewerVCL.dpr # Main program file
305+ │ │ ├── DX.PdfViewerVCL.dproj # Delphi project file
306+ │ │ ├── Main.Form.pas # Main application form
307+ │ │ └── Main.Form.dfm # Form layout
308+ │ └── tests/ # Unit tests
279309│ ├── DxPdfium4dTests.dpr # Test project
280310│ ├── DxPdfium4dTests.dproj # Test project file
281311│ └── DX.Pdf.Document.Tests.pas
282- ├── assets/ # Icons and logos
283- │ ├── Icon.svg # Application icon (source)
284- │ └── Logo.svg # DX Pdfium4D logo
285- ├── samples/ # Sample PDF files for testing
312+ ├── assets/ # Icons and logos
313+ │ ├── Icon.svg # Application icon (source)
314+ │ └── Logo.svg # DX Pdfium4D logo
315+ ├── samples/ # Sample PDF files for testing
286316│ ├── Simple PDF 2.0 file.pdf # Basic PDF 2.0 example
287317│ └── pdf20-utf8-test.pdf # Complex PDF with UTF-8, bookmarks, layers
288- └── lib/ # Third-party libraries
289- ├── pdfium-bin/ # PDFium binaries
290- └── DUnitX/ # Unit testing framework
318+ └── lib/ # Third-party libraries
319+ ├── pdfium-bin/ # PDFium binaries
320+ └── DUnitX/ # Unit testing framework
291321```
292322
293323
@@ -303,16 +333,22 @@ DX-Pdfium4D/
303333- Minimal abstraction
304334
305335** 2. High-Level Classes (` DX.Pdf.Document.pas ` )**
306- - Object-oriented wrapper with automatic resource management
307- - Reference counting for documents and pages
336+ - Object-oriented wrapper with automatic PDFium resource cleanup
308337- Metadata extraction (title, author, PDF/A compliance, etc.)
309338- Bitmap rendering with configurable DPI
310339
311- ** 3. Visual Component (` DX.Pdf.Viewer.FMX.pas ` )**
312- - FMX component for displaying PDFs
340+ ** 3. Viewer Core (` DX.Pdf.Viewer.Core.pas ` )**
341+ - Shared viewer logic for FMX and VCL
342+ - Page navigation and state management
343+ - Platform-independent functionality
344+
345+ ** 4. Visual Components**
346+ - ** FMX Component (` DX.Pdf.Viewer.FMX.pas ` )** - Cross-platform PDF viewer
347+ - ** VCL Component (` DX.Pdf.Viewer.VCL.pas ` )** - Windows-native PDF viewer
313348- Automatic page navigation
314349- Drag & Drop support
315350- Background rendering for smooth UI
351+ - Proper aspect ratio preservation
316352
317353### Threading Model
318354
0 commit comments