Files
egg 24253ac15e 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>
2025-12-12 07:50:43 +08:00

2.3 KiB

ADDED Requirements

Requirement: Direct Track Background Image Rendering

The system SHALL render Direct Track PDF output using a full-page background image with an invisible text overlay to preserve visual fidelity while maintaining text extractability.

Scenario: Render Direct Track PDF with background image

  • WHEN generating Layout PDF for a Direct Track document
  • THEN the system SHALL render each source PDF page as a full-page background image at 2x resolution
  • AND overlay invisible text elements using PDF Text Rendering Mode 3
  • AND the invisible text SHALL be positioned at original coordinates for accurate selection

Scenario: Handle Office documents (PPT, DOC, XLS)

  • WHEN processing an Office document converted to PDF
  • THEN the system SHALL use the same background image + invisible text approach
  • AND preserve all visual elements including vector graphics, gradients, and complex layouts
  • AND the converted PDF in result directory SHALL be used as background source

Scenario: Handle native editable PDFs

  • WHEN processing a native PDF through Direct Track
  • THEN the system SHALL use the source PDF for background rendering
  • AND apply the same invisible text overlay approach
  • AND chart regions SHALL be excluded from the text layer

Requirement: Chart Region Text Exclusion

The system SHALL exclude text elements within chart regions from the invisible text layer to prevent duplicate content and unnecessary translation.

Scenario: Detect chart regions

  • WHEN classifying page elements for Direct Track
  • THEN the system SHALL identify elements with type CHART
  • AND add chart bounding boxes to regions_to_avoid list

Scenario: Exclude chart-internal text from invisible layer

  • WHEN rendering invisible text layer
  • THEN the system SHALL skip text elements whose bounding boxes overlap with chart regions
  • AND chart axis labels, legends, and data labels SHALL NOT be in the invisible text layer
  • AND these texts remain visible in the background image

Scenario: Chart text not available for translation

  • WHEN extracting text for translation from a Direct Track document
  • THEN chart-internal text SHALL NOT be included in translatable elements
  • AND this is expected behavior as chart labels typically don't require translation