Skip to content

feat: convert OFD documents to Markdown #208

Open

Description

@lihongjie0209

Problem and use case

anydoc does not recognize .ofd documents. OFD is a fixed-layout document format used for forms, invoices, and official records. Extracting only raw text loses headings, emphasis, lists, tables, and links that matter in Markdown.

Expected behavior

  • Detect OFD from its package descriptor, including encrypted OFD packages, and recognize .ofd by extension.
  • Convert page and template text in document order through the existing Document model.
  • Preserve styles where the OFD provides reliable evidence: outline headings, larger-font headings, bold/italic runs, printed lists, complete bordered table grids, and URI links.
  • Return NeedsOcr for image-only pages and Encrypted for encrypted packages instead of silently returning incomplete content.
  • Expose the format through the Rust, Node.js, Python, and WebAssembly APIs without adding ofdrw as a runtime dependency.
  • Cover format detection, Markdown output, multi-page ordering, Unicode escapes, tables, links, lists, and error paths with tests.

Conversion limits

OFD describes fixed-page drawing instructions rather than semantic document blocks. Heading size and bordered-table detection are necessarily conservative. Image content, vector drawings, non-link annotations, and OCR are outside the initial conversion scope; documents without enough layout evidence should retain text as paragraphs rather than inventing structure.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions