# Limitations

> What Birch UI Document Editor does not do, or only approximates: layout, floating objects, PDF export, review, forms, collaboration and DOCX validation.

This page lists what the editor does not do, so you can decide before you build on it. Everything here is the behaviour of the current version.

## Layout

- **The browser breaks the lines.** The editor decides which lines go on which page and in which column, but the lines themselves come from the browser's text engine; `documentToPdf` breaks lines itself from font metrics. The two are separate line breakers. On the 12 review documents, with the fonts registered, most of the lines the browser makes end at the same word as in the headless layout (7,997 of 8,126 lines, 98.4%; between 64% and 100% per document, lowest for the HTML-converted article). Line breaks match Word only when the same fonts are installed, and they can differ by a word where the engines disagree about hyphenation. Pair kerning follows the document: it is off unless the document's default text switches *Kerning for fonts* on, as in Word.
- **Compared with LibreOffice on the 94-file corpus**, the editor produces the same number of pages for 90 files and breaks 684 of 706 pages at the same text. The files that differ are a contract with long list items, four templates built from frames, and documents whose fonts fall back differently. The numbers are on the [DOCX page](https://docs.birchui.com/document/docx.md#layout-compared-with-libreoffice).
- **Columns of different widths** move whole blocks from one column to the next. Columns of equal width split paragraphs, tables and lists.
- **A table that splits between columns** is drawn with separate cell borders instead of collapsed ones. A row with a cell that spans rows does not split between pages; it moves to the next page as a whole.
- **Floating pictures and shapes** are placed by the editor. Text flows on both sides of an object with square, tight or through wrapping, and tight and through wrapping follow the wrap polygon of the DOCX file. Both sides are used in left-aligned, centred, right-aligned, justified and right-to-left paragraphs, and inside a table cell for an object anchored in that cell. A side narrower than 72 px stays empty. The lines beside an object are not justified, and the web layout falls back to a plain float with text on one side. A paragraph that continues on the next page runs the full width there; the part of an object that hangs below the bottom margin is cut on screen. In a right-to-left paragraph, a comma or full stop that ends the left-to-right text on one side of the object is drawn at the start of that text. Compared with LibreOffice on 24 documents with floating objects, 968 of 975 lines beside an object start at the same word in Chrome; five of the seven differences are the full stop at the end of a right-to-left paragraph, which the reference PDF reports as a line of its own.
- **Mirror margins** are drawn on screen, in print and in PDF: the left and right margins swap on pages with an even page number, and the gutter stays on the inside. In a table row that itself continues on the next page, the text of the second half and the rows after it follow the margins of the new page, but the cell borders of that second half stay where the row started. **Vertical page alignment** draws *Centre*, *Bottom* and *Justified*. *Justified* hands the free height of a page out evenly above the paragraphs, tables and lists that start on it; the last page of a section and pages with more than one column stay at the top, and the space inside a paragraph or a table is not stretched. Objects positioned relative to the margin are placed from the top margin, not from the lowered text.
- **Endnotes at the end of a section** stay together: when they do not fit below the last text of the section they move to a new page as one block, and a block taller than a page runs past the bottom margin. Endnotes at the end of the document split between pages.
- **Footnotes placed "below text"** keep that setting in the document and in DOCX, but they are drawn at the bottom of the page.
- **Footnote and endnote settings of a single section** (`w:footnotePr` and `w:endnotePr` inside `w:sectPr`) are kept in the DOCX file but not applied; the editor uses the settings of the document. Footnote numbers that restart on each page are shown on the page; the note list of the web layout and screen-reader labels count through the section or document.
- **Page borders** are a box of single, double, dashed or dotted lines, measured from the edge of the page. Art borders and other line styles of an imported file stay in the DOCX file and are drawn as a solid line. `documentToPdf` on a server draws neither page borders nor the shadow of a paragraph border.
- **A paragraph inside a list item** splits between pages in a section with one column. In a section with several columns the item moves as a whole. A table inside a list item does not split.
- **Frames** (`w:framePr`) are laid out as ordinary paragraphs.
- **The run formatting of a table style** (bold, italic, colour, font and size of the whole table and of the first row, last row, first and last column and bands) is drawn on the cells and follows the style and the table's style options. It is drawn, not copied into the text: `getJSON` has no marks for it. Paragraph formatting of a table style is not applied. `documentToPdf` on a server does not apply it.
- **List labels** come from the numbering engine for every list: Word numbering (`%1.%2`, `(%3)`, legal numbering, restarts, start values, numbering linked to heading styles) and the bullets and numbers of lists made in the editor. They are the same on screen, in print, in both PDF exports and in cross-references. Bold, italic, colour, font and size set on a numbering level are applied to the label. A label wider than its hanging indent overlaps the text instead of pushing it to the next tab stop, and in a centred or right-aligned numbered paragraph the label is placed at the start of the first line. Multilevel lists defined in the editor's own dialog are numbered by the same engine but still drawn with CSS counters.
- **Headings inside list items** are not listed in the navigation pane.

## PDF export

- Fonts are embedded as subsets when their files are available: registered with `pdfFonts`, returned by `fontLoader`, or read through the browser's Local Font Access API. Otherwise the standard Helvetica, Times and Courier are used and scaled to the measured widths. WOFF, WOFF2 and CFF2 fonts are not read, and variable fonts are embedded at their default instance.
- Arabic is joined from the font's own substitution tables and placed where the browser placed it, but marks are positioned approximately, and Indic and Thai scripts are not shaped.
- The file is tagged and carries PDF/A-oriented metadata on request. It has not been checked with a PDF/A or PDF/UA validator.
- `documentToPdf` on a server shares the pagination engine with the editor and measures with font metrics instead of the browser. Sections, landscape pages, equal-width columns, tab leaders, document styles and header rows that repeat on every page are laid out; rows and footnotes do not split, unequal columns are laid out as equal ones, and shapes are not drawn. On the 12 review documents the editor gives LibreOffice's page count for 11 and `documentToPdf` for 11; both give 204 pages for the 203-page manual. See [PDF on a server](https://docs.birchui.com/document/pdf-and-print.md#pdf-on-a-server).
- `pdfA: true` fails with `PdfFontError` unless every font is supplied.

Printing through the browser (`print()`, `getPrintHtml()`) always matches the screen. See [PDF and print](https://docs.birchui.com/document/pdf-and-print.md).

## Watermark and emoji

- A watermark is written to the default, first-page and even-page headers that the document has. A section with **Different first page** and no first-page header shows no watermark on its first page in Word; the editor draws it on every page.
- Washout of a picture watermark is drawn at 28% opacity; Word draws it with gain and black level, which looks lighter on dark pictures.
- A watermark of a Word file that is not one of Word's two watermark shapes (for example a picture placed behind the text of the header by hand) stays an object in the header.
- The emoji picker holds 80 emoji in five groups and has no search. An emoji is text: it is drawn with the emoji font of the device, so it looks different in Word on another system, and the PDF made by `documentToPdf` draws it only when a font with those glyphs is supplied.

## Picture effects

- Brightness and contrast are drawn with CSS `brightness()` and `contrast()`, which is close to Word's luminance change but not the same curve; sepia and washout are approximations of Word's presets. Word writes sepia with tint and saturation modifiers, which are read as sepia and written back in a simpler form once the picture is changed.
- The PDF made by `documentToPdf` and by the editor's own PDF export draws the picture without its effects; printing to PDF through the browser keeps them.
- Other DrawingML effects of a picture (glow, reflection, bevel, 3-D rotation, artistic effects, saturation and colour temperature) are kept in an untouched picture and are not drawn.

## Drawing

- Ink is written as freeform shapes, not as Word's ink part (InkML): Word shows and moves the strokes but its own Draw tab does not treat them as ink (no ink eraser, no ink replay). Ink drawn in Word is kept as a preserved drawing and is not edited here.
- Drawing needs a pointer (mouse, pen or touch). From the keyboard the tools can be switched on and off and strokes selected, moved, described and deleted; `insertInk` adds a stroke from code.
- Strokes have one width: pen pressure and tilt are not recorded. The eraser removes whole strokes. A stroke cannot be resized or rotated.
- The Draw tab is not offered in the classic toolbar.

## Charts

- Charts are drawn by a renderer of this package, not by the chart renderer of the Spreadsheet: this package depends on `@birchui/core` and `@birchui/license` only, and the Spreadsheet does not export its renderer. The look is close to Office's default style and is not themed by the document.
- Seven chart types are read, drawn and written (column, bar, line, area, pie, doughnut, scatter), clustered, stacked or stacked to 100%. Combination charts and other types stay preserved drawings.
- Editing a chart from a Word file replaces its formatting with the default style; only the title, the axis titles, the legend position and the series colours are kept. Undo restores the original.
- The chart dialog takes the data as text; there is no cell grid. A chart cannot be linked to a table of the document or to a spreadsheet file.
- A chart written by the editor has not been opened in Microsoft Word in this project; the parts follow the schema and pass the package validator, and LibreOffice opens them.

## Citations

- The three citation styles follow the common cases of APA 7, MLA 9 and Chicago 17 author-date: books, book sections, journal and periodical articles, conference papers, reports and web pages, with personal or corporate authors. They are not the XSL style sheets of Word, so an entry can differ from Word's in detail (Word's APA is the sixth edition and prints the city of the publisher), and styles other than these three (IEEE, Harvard, GOST, ISO 690) are read as APA.
- A citation that Word shows with a title or a suffix switch (`\t`, `\s`, `\f`, `\v`) keeps the switch in the file but is formatted without it.
- The list of sources is not part of the undo history and is not merged between collaborators; the citations and bibliography in the text are.
- There is no master list of sources shared between documents.

## Tables, pictures and equations

- **A floating picture can stand above the paragraph that holds its anchor**, with two exceptions: a picture whose horizontal position is relative to the page, and a picture aligned to the bottom of the page or margin, stay at or below their paragraph. A picture with a negative offset from its paragraph is placed as LibreOffice places it: from where the paragraph stood before the text above made room for the picture.
- **A picture alone on the last line of a paragraph that also holds text** makes that line about 3 px taller than in LibreOffice. It is the one of the 65 pictures of the comparison that is more than 2 px off.
- **A rotated inline picture** takes the room of its turned outline, which the editor works out from the angle. `wp:effectExtent` itself is not read, so a shadow or glow that Word adds to the extent is not counted.
- **A header or footer taller than the margin** moves the body text, as in Word. All pages of a section take the tallest of its headers (default, first page, even pages), so a first page with a shorter header starts its text as low as the others. A header or footer never takes more than a third of the page.
- **A floating picture that hangs below the bottom margin** is cut at the margin on screen; LibreOffice draws it into the margin.
- **Tables of a document in the compatibility mode of Word 2010 and older** are moved left by 5.4 pt, the default cell margin; a table with other cell margins is moved by the same amount. Tables inside cells are not moved.
- **Large bitmaps**: a picture of more than about a megabyte that is shown smaller than a third of its pixel width is drawn from a copy scaled to three times its shown width; the file in the document is untouched and print and PDF export use it. Pictures with a known size are loaded when they come near the viewport. Scrolling the 12 MB test document took 16.7 ms a frame at the median before and after this change (0 of 90 frames over 33 ms both times), so the gain is in memory, not in frame time: the two 2600 × 2600 photographs are held as 1440 × 1440 and 900 × 900 bitmaps.

- Built-in table styles are applied by writing their borders and shading into the cells. Styles imported from a document keep a live link for their run formatting only.
- Equations imported from Word are rendered and editable when their Office Math uses only fractions, scripts, radicals, n-ary operators, delimiters, functions, accents, bars, limits, matrices and equation arrays. An equation with any other structure (a border box, a phantom, a group character such as an underbrace, or an element the converter does not know) is drawn from its parts in a row, without the structure itself, and is edited as Office Math XML instead of LaTeX; the XML is kept as it is in the file. Equations inserted here are written in LaTeX and saved as Office Math. There is no structural editor with placeholders on the page: the gallery inserts LaTeX into the source box of the dialog.
- Charts, SmartArt and grouped shapes from Word are preserved and written back with their fallback picture, not edited.
- Embedded files can be opened by your application, downloaded and inserted, not edited in place. Linked objects stay preserved drawings. See [Embedded objects](https://docs.birchui.com/document/embedded-objects.md).
- EMF and WMF pictures are drawn by the editor from a subset of their records. Clipping, gradient fills, EMF+ records and raster operations other than copying are not drawn. TIFF pictures are kept and exported but shown only by browsers that draw TIFF. A chart inserted through `chartProvider` is a picture; its data stays in the document JSON and is not written to DOCX.
- There are no linked text boxes and no connectors between shapes. Borders drawn or erased with the table tools follow cell edges; a line cannot be drawn through the middle of a cell to split it.

## Forms and protection

- `required` and a custom placeholder text on content controls exist only in the document JSON and are not written to DOCX.
- Protection passwords use Word's hashing scheme and are stored in the DOCX file, but the document is not encrypted: protection stops people who use the editor, not people who edit the file. The hash has not been verified against Microsoft Word itself.

## Review

- Comment mentions are stored with the comment and written to DOCX; the people list of a document is kept. `mentions.onMention` tells your application who was mentioned.
- Balloons are shown for the tracked changes within 200 px of the visible part of the page, however many there are; changes further away get theirs when they scroll into view.
- Tracked changes of table properties, section properties and numbering (`w:tblPrChange`, `w:sectPrChange`, `w:numberingChange`) from a Word file are listed and can be accepted or rejected, but the editor does not record new ones, and rejecting a numbering change keeps the current numbering. Row and cell property changes (`w:trPrChange`, `w:tcPrChange`) are kept in the file and not listed. Inserted, deleted and merged cells from a Word file are listed and can be accepted or rejected; the editor itself records row changes, not single-cell changes.
- A locked track-changes mode is enforced on every transaction: a change that is not recorded as a revision is refused, whatever metadata it carries. This stops code that reaches the editor's view, not someone who edits the saved file.
- Comparing two documents pairs moved text only when you ask for it (`moves: true`) and only for whole paragraphs.
- Comparing tables finds added and removed columns only when neither table has merged cells. An added or removed column is one change in the editor; after export to DOCX and import it is one change for each cell, because Word stores cell revisions cell by cell. Differences in list, table, cell and picture properties are not reported; the redline takes them from the revised version.
- The side-by-side view reflows the text to the width of its panes and is not paginated. Its original pane is the redline with every change rejected.
- Combining two reviewed copies reports a formatting-only change only in a paragraph whose text neither reviewer changed.
- A tracked formatting change keeps the exact earlier formatting through a DOCX round trip.

## Collaboration

- This is a central-authority rebase model, not a CRDT. The editor needs one authority that holds the document and orders steps. There is no peer-to-peer mode. `packages/document/examples/collab-yjs` shows Yjs carrying the messages to that authority; it is an example tested against a stand-in, not a supported adapter, and Yjs does not merge the document. Nothing is shipped for Automerge. See [Collaboration](https://docs.birchui.com/document/collaboration.md#yjs-automerge-and-similar-libraries).
- The authority and the relay validate steps against their own copy of the document. They do not decide who may edit what: that is your `authorize` hook.
- The relay in `packages/document/examples/collab-relay` keeps its log in files, requires an authentication hook, and has rooms and versions. It is a reference implementation for one process, without clustering or rate limiting.
- Edits made offline are kept in memory unless `collabStorage` is set; with `createIndexedDbOfflineStore` they survive a closed tab or a reload. Where IndexedDB is missing the store falls back to memory with a warning, and where it cannot be opened the edits are not stored. A client offline for longer than the retained log loses them.
- Named versions in a collaborative session are stored as the steps since the previous version, with a full document at least every 33rd version. A version stored as steps cannot be read without the versions before it, so the stored list must be kept and deleted as a whole.
- Undo reverts only the local person's edits.

## Text

- **Character scale** (`scale` in the Font dialog) is drawn with the font's own condensed and expanded widths. A font without them is drawn at its normal width; the value is kept and written to DOCX.
- **Small capitals in PDF export** are drawn as capitals at four fifths of the size, as browsers draw them for a font without small capitals; the small-capital glyphs of a font that has them are not used. *Words only* underline leaves the spaces out in the PDF made without a browser (`documentToPdf`) and underlines them in the PDF exported from the editor, which follows the screen.
- **Underline styles** other than single, words only, double, thick, dotted, dashed, dot-dash and wave are kept in an imported file but drawn as a single line. *Words only* underlines the spaces as well.
- **Paste special, Picture**: copied text is drawn as a picture without its formatting, and the dialog can read the clipboard only when the browser allows it. Firefox and Safari ask each time.
- **Click and type** adds paragraphs below the last paragraph of a page and tabs beside a short left-aligned line. It does not work on pages with columns or beside centred, right-aligned or justified text.
- **Link level to style** in a multilevel list sets the style of the items when the list is applied. A paragraph that gets the style later does not join the list.
- **Multilevel lists** defined in the editor are read back from DOCX as the same list. A multilevel list made in Word can be changed in the same dialog, for its first six levels and for the number styles the dialog offers; a level with another number style (for example `decimalZero` or `ordinal`) keeps it unless a different style is chosen. The change is not part of the undo history, and it applies to every list of the document that uses the same definition. A level that one list overrides (`w:lvlOverride` with its own level) keeps its override.
- **Custom document properties** are text, numbers and yes/no values. A date property made in Word is shown as text and written back unchanged unless it is edited.

- **Paste from Word, pictures**: Word puts a `file://` path on the clipboard, which a page cannot read. The picture is pasted empty with its alternative text and size unless `resolvePastedImage` supplies it, for example from the RTF on the same clipboard.
- **Paste from Word, comments and changes**: comment anchors and the comment list are removed and the comments are not imported. Tracked changes are kept only with *Keep source formatting*; moves and formatting changes in the clipboard are pasted as ordinary content. The Word and Google Docs clipboard samples in the test suite are written by hand to match those formats and were not captured from the applications.
- There is no built-in dictionary or grammar engine. The browser's spellchecker is used, or the function you pass as `spellcheck`.
- Touch selection handles are the browser's own. The formatting toolbar for touch and the handling of the on-screen keyboard were tested with emulation, not on a phone.
- The accessibility checks are automated. No screen-reader session has been run; see the [conformance report](https://docs.birchui.com/document/accessibility-conformance.md).
- Text far from the visible pages stays in the DOM (about 6,600 elements for a 204-page document); it is skipped by the browser with `content-visibility`, not unmounted. Page frames with headers and footers are created only near the viewport.

## DOCX validation

The DOCX reader and writer are tested with a corpus of 94 files produced by python-docx and LibreOffice, including LibreOffice's own templates and files converted from ODT, RTF and HTML. Every file is imported, exported, converted to PDF with LibreOffice and compared with the original: the page count is identical, every page starts and ends with the same text, the text is identical, the package validator reports no errors, and a second import and export produces the same file. Content that is not edited is written back with its original XML; a block whose original XML breaks the schema is rebuilt, which happens in 15 of the 94 files (31 blocks of 6,775). **The exported files have not yet been opened in Microsoft Word itself**, because the build machine has no copy of Word. Until that is done, treat Word compatibility as expected rather than verified, and tell us about any file that Word repairs or rejects.

## Security

- Links that can be followed are limited to `http`, `https`, `mailto`, `tel`, relative addresses, bookmarks and the schemes you add with `linkSchemes`; remote pictures are not requested unless `allowRemoteImages` or `resolveImage` is set. A link with a `javascript:`, `vbscript:` or `data:` address is removed from a DOCX package when it is read and its words stay as text. A link with any other scheme (`file:`, `ftp:`, `sms:`, application links) is kept and written back unchanged, but it is shown as a blocked address and cannot be followed. Markdown and PDF export write only the text of a blocked address. Only hyperlinks are treated this way; `INCLUDEPICTURE`, `INCLUDETEXT` and other fields that name a file are kept as they are and are not followed by the editor.
- Archive limits protect against zip bombs by declared and actual size. They do not limit the time a legitimately large document takes to parse.
- The package has not had an external security audit.

## Fonts and page counts

- Lines are broken by the browser in the editor and with font metrics in `documentToPdf`. Page counts match Word only when the document's fonts or their metric-compatible substitutes are present; `fontsMissing` and `missingFonts` say when they are not. The substitution table covers Calibri, Cambria, Arial, Times New Roman, Courier New, Georgia and Segoe UI only.

## Translations

- The editor's strings are shipped in English, German, Spanish, French, Japanese, Brazilian Portuguese and Simplified Chinese (`@birchui/document/locales`). The translations were written for this package and have not been reviewed by native-speaking Word users. Fourteen keys are used with two English wordings in different places and have one translation each.

## Formats

- `.doc` (the binary Word 97–2003 format) can be read with `docToDocument` and **File → Open**, not written. The reader takes text, character and paragraph formatting, lists, tables, pictures, simple shapes, links, notes, comments, tracked insertions and deletions, sections, headers and footers; metafile pictures, cell borders, bookmarks and fields other than hyperlinks in a `.doc` file are not read, and it has been tested with files written by LibreOffice and with files built in the tests, not with files written by Word. See [Word 97–2003](https://docs.birchui.com/document/formats.md#word-972003-doc). Files from Word 95 and older are refused.
- Password-protected `.docx` files open and save through **File → Open**, `openFile(file, { password })` and `exportFile('docx', { password })`; see [The File tab](https://docs.birchui.com/document/ribbon.md#the-file-tab). `readDocx` itself does not decrypt and fails with `DocumentFormatError` and the code `encrypted-or-legacy-doc`. Password-protected `.doc` files are not supported; `docToDocument` fails with `DocFormatError` and the code `encrypted`. Files with rights management (IRM) or a digital-signature-only protection are not supported.
- RTF can be imported, not exported.
- OpenDocument support is a subset; see [Other formats](https://docs.birchui.com/document/formats.md).
- Macros are removed on import.
