Skip to content

Commit d312349

Browse files
committed
docs: cancel Phase 6 (enhanced metadata) due to Android library bug
- AhmerPdfium library caches Meta object at native layer - Same Meta object hashcode observed across different PDFs - Attempted multiple workarounds: OnLoad callback, Recycle(), PdfiumCore - all failed - Feature cancelled to maintain cross-platform parity - Basic metadata (Title/Author/Subject) remains available via DocumentLoadedEventArgs
1 parent 77c6f81 commit d312349

1 file changed

Lines changed: 28 additions & 21 deletions

File tree

FEATURE_ENHANCEMENT_PLAN.md

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ We aim to provide a consistent API across iOS and Android wherever reasonably po
7474
| Title |||| Complete |
7575
| Author |||| Complete |
7676
| Subject |||| Complete |
77-
| Creator |||| ✅ Add with PdfDocument |
78-
| Keywords |||| ✅ Add with PdfDocument |
79-
| Creation/Modification dates |||| ✅ Add with PdfDocument |
77+
| Creator |||| ❌ Cancelled (library bug)|
78+
| Keywords |||| ❌ Cancelled (library bug)|
79+
| Creation/Modification dates |||| ❌ Cancelled (library bug)|
8080
| **Advanced Features** | | | | |
8181
| Text selection |||| ❌ Skip (complex/iOS) |
8282
| Text search |||| ❌ Skip (complex/iOS) |
@@ -139,22 +139,27 @@ We aim to provide a consistent API across iOS and Android wherever reasonably po
139139
- ✅ Graceful error handling for incorrect/missing passwords
140140
- ✅ Merged to main (commit ee2eed9)
141141

142-
### Phase 6: Enhanced Document Metadata (Low Priority)
142+
### Phase 6: Enhanced Document Metadata **CANCELLED**
143143

144-
**Branch:** `feature/metadata`
144+
**Status:** Cancelled due to Android library limitations
145145

146-
**Goal:** Expose richer document metadata across platforms
146+
**Reason:** The AhmerPdfium library has a fundamental bug where the `PdfDocument.Meta` object is cached at the native Pdfium layer and reused across different PDF documents. This causes stale metadata to be returned after switching documents.
147147

148-
#### 6.1 Extended Document Properties
149-
- Add properties to `DocumentLoadedEventArgs`:
150-
- `Creator` (string)
151-
- `Keywords` (string)
152-
- `CreationDate` (DateTime?)
153-
- `ModificationDate` (DateTime?)
154-
- **iOS:** Read from `PdfDocument.DocumentAttributes` dictionary
155-
- **Android:** Attempt to read from `PdfDocument` metadata if available
156-
- Use PdfiumCore API if exposed
157-
- Otherwise return null (graceful degradation)
148+
**Investigation conducted:**
149+
- ✅ Confirmed bug: Same Meta object hashcode across different PDFs
150+
- ❌ Attempted fix: Read metadata in OnLoad callback (per GitHub issue #828) - failed
151+
- ❌ Attempted fix: Call Recycle() before loading new document - failed
152+
- ❌ Attempted fix: Multiple caching strategies (Post, PostDelayed, etc.) - all failed
153+
- ❌ Attempted fix: Open PDF independently with PdfiumCore - caused app crashes
154+
155+
**Root cause:** Native-layer caching in the AhmerPdfium library that cannot be cleared or bypassed
156+
157+
**Alternatives considered:**
158+
1. Fork and fix the library - too invasive
159+
2. Switch to different PDF library - out of scope
160+
3. Accept iOS-only metadata - breaks cross-platform parity goal
161+
162+
**Decision:** Feature cancelled. Basic metadata (Title, Author, Subject) remains available through `DocumentLoadedEventArgs` which works reliably on both platforms.
158163

159164
### Phase 7: Annotation Support (Low Priority)
160165

@@ -312,13 +317,15 @@ For each phase:
312317
| Phase 4 | Core Enhancements | 2-3 days | ✅ Complete |
313318
| Phase 5.1 | Display Mode | 0.5 days | ✅ Complete |
314319
| Phase 5.2 | Password Support | 0.5 days | ✅ Complete |
315-
| Phase 6 | Document Metadata | 0.5-1 day | 📋 Planned |
320+
| Phase 6 | Document Metadata | N/A | ❌ Cancelled |
316321
| Phase 7 | Annotations | 1 day | 📋 Planned |
317322

318-
**Total remaining**: ~1.5-2 days for remaining phases
319-
**Note:** Night Mode feature removed from scope after extensive research and implementation attempts
320-
**Completed**: Phase 4 (2-3 days)
321-
**Project total**: ~5.5-8 days
323+
**Total remaining**: ~1 day for Phase 7
324+
**Notes:**
325+
- Night Mode feature removed from scope (iOS incompatibility)
326+
- Enhanced Metadata feature cancelled (Android library bug)
327+
**Completed**: Phase 4, 5.1, 5.2 (~3.5-4 days)
328+
**Project total**: ~4.5-7 days
322329

323330
## Research Summary
324331

0 commit comments

Comments
 (0)