Someone sends you a .docx on WhatsApp. On a lot of phones, opening it means installing a large office suite, or a "document reader" that uploads the file somewhere to convert it.
I wanted Pagewell, my document reader for Android, to open PDF, Word, Excel and PowerPoint files entirely on the phone. There's no single library that does that well, so it's a different engine per format, chosen by testing rather than by reputation. Here's how it fits together.
Pick engines with ugly files, not pretty ones
Before choosing anything, I collected 30 hard files and opened each candidate on a mid-range phone (a Redmi Note 12): Urdu and Arabic text, documents full of images and charts, a 300-chapter book, a 50,000-row spreadsheet, and a few damaged files. Most libraries handle a tidy sample document fine. The difference shows up on these.
What won:
| Format | Engine |
|---|---|
Android's own PdfRenderer
|
|
| DOCX |
docx-preview in a WebView |
| PPTX |
pptx-to-html in a WebView, patched |
| XLSX | A native Office preview view, with a plain-table fallback |
| XLS and very large XLSX | SheetJS in a WebView, values only |
| TXT, CSV, MD, LOG | A plain TextView, first 2 MB |
Old binary .doc and .ppt files get a clear "old Office format" message instead of a half-broken render. I'd rather say no than show a wrong page.
A WebView that can't reach the internet
Three of those engines are JavaScript, so they run in a WebView. A document is untrusted input, and an HTML-based viewer is exactly where a crafted file could try to load something from the network. So the WebView is locked down:
- The viewer page and its scripts are served from the APK through
WebViewAssetLoader, not from a URL. - The document is copied privately and served at one fixed path,
/doc/current. - Every other request gets an empty response. A document can't fetch a tracking pixel, a font, or anything else.
- File and content access are switched off, and links open in the browser, outside the viewer.
-
textZoom = 100, so the phone's font-size setting doesn't reflow the page into something unreadable.
The result: reading a file never sends it, or anything in it, off the phone.
Two things I had to fix in other people's code
Invisible PowerPoint text. In some decks, text with no colour of its own vanished. The converter fell back to the shape's fill colour, which made white text on a white shape. The fix was to read the colour from the shape style's font reference (fontRef) instead. The patched script ships inside the app.
A dependency with a security advisory. The xlsx package on npm has an unfixed advisory. SheetJS publishes fixed builds on its own CDN, so Pagewell bundles version 0.20.3 from there, not from npm. It's an easy one to miss if you install packages on autopilot.
PDFs: native first
PDFs use the platform's PdfRenderer, which is fast and has no extra dependency. Pages render on one background thread as they scroll into view, with a 96 MB bitmap cache, and they're drawn as sheets of paper with a gap and a soft shadow, sized from the list's real width so they keep their shape.
The one gap: PdfRenderer only accepts a password from Android 15. So for a locked PDF, Pagewell asks for the password, uses PDFBox to decrypt it into a private copy, and renders that.
Getting picked from "Open with"
A reader is only useful if it shows up when you tap a file in another app. The manifest has to match by MIME type, but apps are inconsistent about what they send. WhatsApp, Telegram and many file managers send application/octet-stream for everything, so Pagewell also matches that, plus older and macro-enabled Office types, and falls back to the file extension when no type is sent. The viewer then decides what the file is by its name first.
One phone-specific surprise: Xiaomi's File Manager sends a tapped document straight to WPS Office. There, Pagewell is reachable through a long-press, then "Open in another app".
Remembering recent files had its own catch. Apps usually grant access to a file only until the receiving app closes, so a saved link stops working tomorrow. Pagewell stores a lasting grant when the source offers one, and otherwise (with All files access) the file's own path. An entry that truly can't be reached any more says so and drops off the list.
Editing without breaking the original
The editing tools never change your file; every result is saved as a new copy in Downloads/Pagewell.
- Edit PDF: marks (pen strokes, highlights, text notes) are stored as fractions of the page, so they survive zoom. On save, each edited page gets one transparent PNG at twice the page size laid over it with PDFBox. That keeps handwriting and every language exactly as drawn.
-
Edit Word: each paragraph of
word/document.xmlbecomes a text field. A changed paragraph keeps its first run's formatting, unchanged ones stay exactly as they were, and every other part of the zip is copied untouched. The honest limit: mixed formatting inside a paragraph you edit gets flattened. - Compress redraws each page as a JPEG at 72, 110 or 150 dpi. It's the only approach that shrinks any PDF, at the cost of turning text into pictures.
Known limits
Excel charts and images inside sheets aren't drawn, right-to-left sheets can clip text, and very large sheets open as a plain table. Old .doc and .ppt files don't open at all. Better to list these than pretend the engines cover everything.
Pagewell is on Google Play. Reading is free, with no ads while you read and no account. Pro unlocks the tools: signing and editing PDFs, editing Word text, and merging, extracting, compressing or locking PDFs. If you've found a file format that breaks a WebView viewer, send it my way.
Top comments (0)