Files
OCR/openspec/changes/improve-translated-text-fitting/tasks.md
egg 08adf3d01d feat: add translated PDF format selection (layout/reflow)
- Add generate_translated_layout_pdf() method for layout-preserving translated PDFs
- Add generate_translated_pdf() method for reflow translated PDFs
- Update translate router to accept format parameter (layout/reflow)
- Update frontend with dropdown to select translated PDF format
- Fix reflow PDF table cell extraction from content dict
- Add embedded images handling in reflow PDF tables
- Archive improve-translated-text-fitting openspec proposal

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 10:10:28 +08:00

31 lines
1.4 KiB
Markdown

## 1. Backend Implementation
- [x] 1.1 Create `generate_reflow_pdf()` method in pdf_generator_service.py
- [x] 1.2 Implement `_get_elements_in_reading_order()` for both tracks
- [x] 1.3 Implement reflow text rendering with consistent font sizes
- [x] 1.4 Implement table rendering in reflow mode (Platypus Table)
- [x] 1.5 Implement inline image embedding
- [x] 1.6 Add `format=reflow` query parameter to tasks download endpoint
- [x] 1.7 Update `generate_translated_pdf()` to use reflow mode
## 2. Frontend Implementation
- [x] 2.1 Add "Download Reflow PDF" button for original documents
- [x] 2.2 Update download logic to support format parameter
- [x] 2.3 Remove MADLAD-400 badge (line 545)
- [x] 2.4 Update translation description text to reflect Dify cloud service (line 652)
## 3. Testing
- [x] 3.1 Test OCR track reflow PDF (with reading_order) - Basic smoke test passed
- [ ] 3.2 Test Direct track reflow PDF (implicit order) - No test data available
- [x] 3.3 Test translated PDF (reflow mode) - Basic smoke test passed
- [x] 3.4 Test documents with tables - SUCCESS (62294 bytes, 2 tables)
- [x] 3.5 Test documents with images - SUCCESS (embedded img_in_table)
- [x] 3.6 Test multi-page documents - SUCCESS (11451 bytes, 3 pages)
- [x] 3.7 Verify layout PDF still works correctly - SUCCESS (104543 bytes)
## 4. Documentation
- [x] 4.1 Update spec with reflow layout requirements