feat: unify Direct Track PDF rendering and simplify export options

Backend changes:
- Apply background image + invisible text layer to all Direct Track PDFs
- Add CHART to regions_to_avoid for text extraction
- Improve visual fidelity for native PDFs and Office documents

Frontend changes:
- Remove JSON, UnifiedDocument, Markdown download buttons
- Simplify to 2-column layout with only Layout PDF and Reflow PDF
- Remove translation JSON download and Layout PDF option
- Keep only Reflow PDF for translated document downloads
- Clean up unused imports (FileJson, Database, FileOutput)

Archives two OpenSpec proposals:
- unify-direct-track-pdf-rendering
- simplify-frontend-export-options

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-12 07:50:43 +08:00
parent 53bfa88773
commit 24253ac15e
15 changed files with 891 additions and 195 deletions

View File

@@ -0,0 +1,46 @@
## ADDED Requirements
### Requirement: Translation Output as Reflow PDF
The system SHALL generate translated documents as reflow-layout PDFs with real visible text, separate from the Layout PDF which uses background images.
#### Scenario: Generate translated PDF with reflow layout
- **WHEN** translation is completed for a document
- **THEN** the system SHALL generate a new PDF with translated text
- **AND** the translated PDF SHALL use reflow layout (not background image)
- **AND** text SHALL be real visible text, not invisible overlay
- **AND** page breaks SHALL correspond to original document pages
#### Scenario: Maintain page correspondence in translated output
- **WHEN** generating translated PDF
- **THEN** content from original page 1 SHALL appear in translated page 1
- **AND** content from original page 2 SHALL appear in translated page 2
- **AND** each page may have different content length but maintains page boundaries
#### Scenario: Chart text excluded from translation
- **WHEN** extracting text for translation from Direct Track documents
- **THEN** text elements within chart regions SHALL NOT be included
- **AND** chart labels, axis text, and legends SHALL remain untranslated
- **AND** this is expected behavior documented for users
### Requirement: Dual PDF Output Concept
The system SHALL maintain clear separation between Layout PDF (preview) and Translated PDF (output).
#### Scenario: Layout PDF for preview
- **WHEN** user views a processed document before translation
- **THEN** the Layout PDF SHALL be displayed
- **AND** Layout PDF preserves exact visual appearance of source
- **AND** text is invisible overlay for extraction purposes only
#### Scenario: Translated PDF for final output
- **WHEN** user requests translated document
- **THEN** the Translated PDF SHALL be generated
- **AND** Translated PDF uses reflow layout with visible translated text
- **AND** original visual styling is not preserved (text-focused output)
#### Scenario: Both PDFs available after translation
- **WHEN** translation is completed
- **THEN** both Layout PDF and Translated PDF SHALL be available for download
- **AND** user can choose which version to download
- **AND** Layout PDF remains unchanged after translation