Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Reconstructing Word .docx OpenXML Paragraphs and Multi-Column Tables From Fixed-Coordinate PDF Glyphs

\ Canonical Engineering Monograph: https://nandai.org/blog/reconstructing-docx-openxml-paragraphs-tables-from-pdf-glyphs · Zero-Upload Local Converter: nandai.org/convert/pdf-to-word-docx An untagged PDF file ( ISO 32000-2 ) does not contain paragraphs, table cells, or heading nodes. Unless the producer embedded a /StructTreeRoot accessibility tree, the page content stream stores low-level…

PDF files lack structured paragraphs, table cells, or headings without additional metadata. When text spans overlap, converters often wrap glyphs in Word text boxes for visual accuracy, but this leads to issues when editors add content. To create editable OpenXML (.docx) files directly in a browser, a deterministic geometric reconstruction pipeline is needed.

First, glyph spans are extracted with normalized coordinates in PDF units (1 pt = 1/72 in) that are translated to top-down page coordinates. Then, for multi-column pages, vertical whitespace gutters are detected to prevent line merging. Column gutters are identified through 1 pt horizontal bins and occupancy accumulation, followed by sorting reading regions.

Next, y-baseline lines are merged when their vertical difference is within 25% of the cap height. Word gaps are handled by joining fragments within 0.18 * font size, and inserting spaces for gaps in between. Paragraphs are formed by joining lines, unless broken by structural elements like paragraph breaks or list markers.

Tables are reconstructed from PDF vector rulings or borderless gutter patterns. Vector-rules define exact grid coordinates, while borderless tables use repeated X-gutter centroids to infer column structures. The resulting table elements are packaged in a strict ZIP archive containing necessary XML files, ensuring compatibility across different word processing software.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

More from Dev.to on urgent.news

Get the news by email. Yesterday's most-covered stories, every morning.

See today's edition · More options

More in Tech

More from Saturday, 5 December 2026 →