Commit Graph

8 Commits

Author SHA1 Message Date
Brandon Thomas 2aca0692fc
Fix #526: keep text colour in Word, HTML and RTF export (#547)
The export model (`pdfcraft_export::Block`/`Cell`) had no colour, so
`export_pages` dropped the fill colour that `edit::TextBlock` already
carries and every run came out black.

Block and Cell now carry an sRGB colour, mapped from TextBlock.color.
Word runs get `<w:color w:val="RRGGBB"/>`, HTML paragraphs, headings and
cells a `style="color:#RRGGBB"`, and RTF a colour table with `\cfN`.
Black text keeps each format's default; NaN and out-of-range components
clamp.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 10:49:21 -04:00
Erige005 bc1d67cb61
Export to Word: detect tables of at most 63 columns, Word's limit (#479) (#483) 2026-10-09 09:14:34 -04:00
Brandon Thomas d3db99818f
Rename PrintCraft to PdfCraft (#174)
The app, crates, binaries, bundle id, packaging, icons, screenshots and docs are now
PdfCraft / pdfcraft (repo storytold/pdfcraft). On first launch the desktop app moves the
PrintCraft settings and crash-recovery folders to the new name, and both apps read settings
saved under the old storage key, so upgrades keep recent files, preferences and unsaved work.
The signing test fixtures keep their PrintCraft subject names (they are binary).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 16:03:57 -04:00
bflatastic 8b25d88450 Export to Word: files open in Word again (#72)
Text extracted from a PDF can hold C0 control characters (fonts without
a usable /ToUnicode), which XML forbids, and Word refuses the whole
document over one ("Word experienced an error trying to open the
file"). The Word, HTML and RTF writers now drop the characters XML
forbids. Also:
- the page size stays within Word's 22 in (a till receipt is taller,
  and Word read it as a negative height), and margins shrink on small
  pages so text keeps room; images fit the real text width;
- a non-finite font size falls back to 12 pt;
- zip entries get a valid DOS date (1980-01-01) instead of zero.

Checked by opening the exports in Microsoft Word: control characters,
U+FFFE/U+FFFF, a 33 in receipt with a 40-row table, narrow, tiny and
wide pages all open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 01:31:37 +07:00
Brandon Thomas 604c560e5f Export tables: linear column lookups, a column cap, RTF spans
Review follow-ups on top of the table detection:
- Each block's column comes from a precomputed map and a binary search
  instead of scanning every column's members, so pages with many text
  blocks stay linear.
- A table has at most 64 columns. Rows are materialized to every column, so
  a hostile page laid out as a staircase of blocks would otherwise make
  (blocks / 2)^2 cells. Test: a_staircase_of_blocks_is_not_a_huge_table.
- RTF: a row's cell boundaries are written before its cells (RTF requires
  it), and a spanning cell ends at the last column it spans. The test checks
  the Totals row now spans two columns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 07:38:17 -04:00
Brandon Thomas 28108ec555 Export detected tables to office formats 2026-10-06 07:38:17 -04:00
Brandon Thomas 1434db626a Never crash: deny the panic lints in crates that are already clean
annot, compare, content, cos, export, geom, model, ocr, preflight, print and redact have no
production `unwrap`/`expect`/`panic!`/`unreachable!`/`todo!`/`unimplemented!`. The attribute
keeps it that way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 13:12:21 -04:00
Brandon Thomas 70280a44d0 M10: Export to Word (.docx), HTML and RTF (new export crate with a small zip writer): paragraphs, headings, bold/italic, images, page breaks; doc_export_office tool
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 09:40:46 -04:00