Preview documents in the browser, without an office suite

BDF is a browser document-preview suite: it combines converters for many formats (Go/WASM), a browser renderer of about 23 KB gzipped, and a compact intermediate format.

PDF is a portable, PostScript-based format for printing. By contrast, BDF is a lightweight intermediate format built from Canvas 2D drawing commands for fast browser rendering. Generate BDF ahead of time on a server, or convert files in real time in the browser with WebAssembly.

Open the viewer Read the docs GitHub

A PDF, drawn from BDF

Converted ahead of time, as a server would. Turn its pages, select its text, search it, zoom.

demo.pdf → demo.bdf

742 KB as a PDF of 20 pages, 392 KB as BDF with its fonts. The pages are fetched by range requests as they are about to be shown.

And back out of BDF

The document above, demo.bdf, written back as a PDF file and as Markdown, and its text handed to a search index: each made inside your browser by the same Go code a server runs, built as WebAssembly. Nothing is uploaded.

A PDF file of the pages, with the fonts of the document embedded: plain, or tagged with its structure for screen readers. The browser's own PDF viewer shows the result below.

bdf pdf -tagged demo.bdf demo-from-bdf.pdf

Less time, memory and energy for document previews

Compare the same Office files converted by LibreOffice + Poppler and by BDF's Go converter.

Conversion + thumbnail time (median)

  • Basic DOCX

    LibreOffice + Poppler 0.69 s
    BDF (Go) 0.05 s
  • Basic PPTX

    LibreOffice + Poppler 1.01 s
    BDF (Go) 0.03 s
  • Basic XLSX

    LibreOffice + Poppler 0.65 s
    BDF (Go) 0.04 s
  • Synthetic XLSX · 4 sheets × 3,000 rows

    LibreOffice + Poppler 1.55 s
    BDF (Go) 0.23 s
  • Synthetic PPTX · 100 slides

    LibreOffice + Poppler 56.38 s
    BDF (Go) 0.12 s
Bar lengths are scaled within each input pair; values are the measured results.

Maximum RSS (median)

  • Basic DOCX

    LibreOffice + Poppler 161.8 MiB
    BDF (Go) 43.4 MiB
  • Basic PPTX

    LibreOffice + Poppler 147.3 MiB
    BDF (Go) 38.2 MiB
  • Basic XLSX

    LibreOffice + Poppler 123.7 MiB
    BDF (Go) 36.0 MiB
  • Synthetic XLSX · 4 sheets × 3,000 rows

    LibreOffice + Poppler 288.3 MiB
    BDF (Go) 48.7 MiB
  • Synthetic PPTX · 100 slides

    LibreOffice + Poppler 1,918.9 MiB
    BDF (Go) 40.8 MiB
Bar lengths are scaled within each input pair; values are the measured results.

Estimated SoC energy per document

  • Per-document average across Basic DOCX, Basic PPTX, Basic XLSX

    LibreOffice + Poppler 4.27 J
    BDF (Go) 0.24 J
Bar lengths are scaled within each input pair; values are the measured results.
Range across 3 rounds: LibreOffice + Poppler 3.30–7.16 J/document; BDF 0.24–0.25 J/document.

On an Apple Silicon Mac connected to AC power. Time and maximum RSS are medians of 5 fresh-process runs for conversion plus a 256 px first-page thumbnail; the large XLSX and PPTX inputs are synthetic. Energy is an idle-adjusted CPU, GPU and ANE SoC estimate from powermetrics across 3 rounds of Basic DOCX, Basic PPTX, Basic XLSX, divided by completed documents—not a wall-outlet measurement.

A sheet stays a sheet that scrolls; a book turns its pages. All of them are drawn by the same renderer.

29 formats in all, among them Visio, Illustrator, Photoshop, TIFF, HTML, Markdown and font files: all formats

Try it with your files

Files are converted inside your browser. They are not uploaded.

Fit it into your system

Three sample projects, each a small Go server with its pages.

Why BDF

More about why