Abstract
FlexDoc is a novel framework that moves beyond traditional "responsive design" by jointly optimizing both document layout and content. By combining discrete template selection with continuous optimization of text length (via BERT) and image dimensions (via seam carving), it creates documents that seamlessly adapt to any screen size and user preference without requiring manual breakpoints or coding. Our evaluation demonstrates that FlexDoc can re-optimize layouts in under 0.5 seconds, providing a superior experience for both authors and viewers.
Introduction
In the current digital landscape, a single document might be viewed on devices ranging from 6-inch smartphones to 32-inch 4K monitors. Traditional solutions like CSS media queries or Adobe’s "Liquid Mode" suffer from significant friction. Authors must manually define "breakpoints" or write complex code, and content remains static regardless of the display size. A long paragraph that works on a desktop becomes an exhausting "wall of text" on a phone. Furthermore, viewers have little control over the level of detail or the balance between images and text. FlexDoc addresses these challenges by creating "truly" adaptive documents where the system automatically decides what to show, how much to show, and where to put it.
Methods
FlexDoc treats document adaptation as a joint optimization problem consisting of two main components: an optimization engine and dynamic content generation.
Optimization Engine
The engine utilizes a combination of Discrete Loss (choosing between different layout templates and content versions) and Continuous Loss (fine-tuning the exact size and position of elements). It employs a symbolic layout approach where elements are anchored to "tabstops"—vertical and horizontal grid lines—allowing the layout to stretch and compress mathematically. The engine minimizes loss related to image distortion, text readability, and aesthetic alignment.
Dynamic Content Generation
Unlike traditional systems that merely scale elements, FlexDoc modifies the content itself. It uses BERT-based models to generate multiple versions of text at different lengths. If space is constrained, the system displays a summary; if the user "zooms in," it reveals the full text. For images, it employs seam carving—a content-aware resizing technique—to change aspect ratios while preserving important visual features.
Key Results and Insights
Evaluation of the FlexDoc framework through user studies with professional designers and various application scenarios yielded several key findings:
- Performance: The system can re-optimize and adapt a UI in under 0.5 seconds on a standard laptop, enabling real-time window resizing.
- Content as a Variable: By treating text length as a parameter to be optimized, the layout remains elegant on any device. The "zoom" metaphor allows users to trigger the optimization engine to replace summaries with full-length text dynamically.
- Comparison with Industry Standards: Unlike CSS or Webflow, FlexDoc is the only system tested that supported both "image flow" and "adaptive content" (summarization) without manual intervention.
Conclusion
While FlexDoc represents a significant leap forward, it has limitations. The current system lacks "semantic understanding" of the relationship between elements, such as ensuring a specific caption stays with its image unless manually constrained. Future work will focus on developing mathematical metrics for "adaptive UI quality" and handling more complex, non-rectangular layouts. By bridging the gap between component-level design and overall layout, FlexDoc significantly reduces the time spent on tedious alignment tasks while enhancing the viewer's experience.
Summary updated