mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-20 19:18:41 +00:00
#7814 brought this branch's first two commits to main inside step 2, but not the three fixes made here since: the RTF picture budget that counts every placement, rotations baked into the pictures, pictures fitted to the text height, and the pages that lost a picture reported through truncated_pages. They now sit in step 2's Builder: RTF's flow_doc gives it a pictures::Budget, and Word's word_doc doesn't, so Word keeps its own limits (room_for) and turns positioned pictures through their float. The text-height fit is in the shared picture(), so Word's flowing pictures fit too. The truncated_pages doc now says what RTF reports: pictures lost to its own limits or a rotation it couldn't bake. A picture no format can encode is left out of all of them.
50 lines
1.8 KiB
Rust
50 lines
1.8 KiB
Rust
//! pdfcraft-export — Export a PDF ▸ Word, HTML, RTF, Markdown (L4).
|
|
//!
|
|
//! The engine reduces each page to [`Page`]: paragraphs (text, box, size, bold/italic) and
|
|
//! images (encoded bytes and box), in reading order. The writers turn that into a flowing
|
|
//! document: headings are the paragraphs set larger than the body text; a block that
|
|
//! continues another on its line (an italic word, a link) is a run of that block's paragraph, and
|
|
//! a paragraph that wraps onto the next line runs on there. Word keeps pages with
|
|
//! rotated text, or text overlapped by artwork or watermark-sized text, as positioned, editable
|
|
//! shapes to avoid reflowing overlays; other pages flow with images inline.
|
|
|
|
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
|
|
|
mod pptx;
|
|
mod zip;
|
|
|
|
pub use pptx::pptx;
|
|
pub use zip::Zip;
|
|
|
|
mod as_docx;
|
|
mod as_html;
|
|
mod as_markdown;
|
|
mod as_rtf;
|
|
mod as_word;
|
|
mod clip;
|
|
mod flow;
|
|
mod layout;
|
|
|
|
#[cfg(test)]
|
|
use as_docx::MAX_MEDIA;
|
|
pub(crate) use as_docx::hex;
|
|
pub use as_docx::{docx, docx_with_language};
|
|
pub(crate) use as_html::esc;
|
|
#[cfg(test)]
|
|
use as_html::{allowed, base64};
|
|
pub use as_html::{html, html_simple, html_simple_with_language, html_with_language};
|
|
pub use as_markdown::markdown;
|
|
#[cfg(test)]
|
|
use as_markdown::{emphasis, paragraph};
|
|
pub use as_rtf::{rtf, rtf_with_title, rtf_with_title_checked};
|
|
pub use clip::{ClipBuilder, ClipSpan, ClipStyle, ClipText, MAX_CLIP_HTML_BYTES, MAX_CLIP_SPANS, MAX_CLIP_TEXT_BYTES, clip_html, font_family};
|
|
#[cfg(test)]
|
|
use flow::list_item;
|
|
pub use layout::{Block, Cell, Image, Page, Table};
|
|
#[cfg(test)]
|
|
use layout::{LOOKUP_STEPS, MAX_COLS, body_size};
|
|
pub(crate) use layout::{Run, flowing_paragraphs, reading_order, tables};
|
|
|
|
#[cfg(test)]
|
|
mod tests;
|