Blog

On-device AI needs an on-device document engine

Local models are only as useful as the files they can read. OfficeAPI converts and previews Office documents on the device, so the AI feature and the data stay in the same place.

Definition. An on-device document engine converts and renders office files on the same hardware that runs a local model, so the AI feature never has to upload a document to be able to read it. Running a model on the device is a promise to the user that data does not leave; the promise breaks the moment the app must upload a .docx to a conversion service first.

Where is the gap between files and models?

The documents people care about are Office files: a contract in Word, a budget in Excel, a proposal in PowerPoint. Local pipelines usually want something else: page images for a vision model, a PDF for a document pipeline, CSV for a table. Getting from one to the other is a conversion step, and where that step runs decides whether the feature is really on-device.

What can OfficeAPI do beside the model?

OfficeAPI is a Rust document engine that runs fully offline on Windows, Linux, macOS, Android, iOS, and HarmonyOS. Inside your app it can:

  • convert Word, Excel, and PowerPoint files to PDF, JPEG/PNG/BMP, SVG/TIFF/EMF, or CSV on the device — 42 documented pairs in total;
  • render a preview of the original or generated document in your own UI — 32 documented extensions;
  • do both with zero dependencies, so nothing extra is installed next to your model.

Which output should the model get?

Model input you need OfficeAPI output Families
Page images JPEG, PNG, BMP Word, Excel
One portable document PDF Word, Excel, PowerPoint
Tabular data CSV Excel
Scalable graphics SVG, TIFF, EMF Word, Excel

How do you wire it up?

  1. Confirm the source extension is a documented conversion input.
  2. Convert on the device to the format your pipeline reads.
  3. Hand the result to the model running beside your app.
  4. Render the source or the generated document with preview so the user can check it.

How do you close the loop with the user?

An on-device AI feature is rarely fire-and-forget. The user wants to see what the model read and check what it produced. Preview handles that: render the source document or the result inside the app, on the same device, without a hosted viewer.

On-device versus cloud conversion

OfficeAPI on the device Cloud conversion service
Document leaves the device No Yes
Consistent with an on-device model Yes No
Works offline Yes No
Dependencies None Client, credentials

Frequently asked questions

Does OfficeAPI run the model?

No. It converts and previews documents; the model is yours.

Which platforms does this work on?

All 6 supported operating systems: Windows, Linux, macOS, Android, iOS, HarmonyOS.

Is a PDF or an image better for the model?

Use page images (JPEG, PNG, BMP) for a vision model reading Word or Excel pages; use PDF when your pipeline consumes a single document, including PowerPoint.

Read more

References

See it in the matrix

Check the formats behind the article.

Browse supported formats