Skip to content

PDF-SDK 2.4.1 is out.See what’s new

PDF-SDK

PDF glossary

WebAssembly (Wasm)

A portable binary format that browsers run at near-native speed, used to bring code written for other platforms to the web.

WebAssembly lets the same engine that runs in a native app run inside a browser tab, next to JavaScript. With threads it can use several cores — which browsers allow only on cross-origin isolated pages.

A browser downloads a .wasm file, compiles it and runs it in the same sandbox as JavaScript, so it gets no extra access to the user’s device. JavaScript calls into it and passes data back and forth, which suits heavy work such as rendering pages or rewriting a file.

Serving it well takes a little care. The file should be sent as application/wasm so the browser can compile it while it downloads, and it should be compressed, because engines can be several megabytes. Long cache headers mean a returning visitor doesn’t download it again.

Threads need more. They rely on SharedArrayBuffer, which browsers only allow on cross-origin isolated pages, served over HTTPS with the COOP and COEP headers. Those headers also limit what the page can load from other sites, so it is common to apply them only to the page that needs them.

It doesn’t replace JavaScript. The page, its buttons and its layout stay in JavaScript and HTML, and WebAssembly does the heavy work underneath. It runs in every current major browser, so a visitor has nothing to install. For a PDF editor, that means the same engine can open and change a file right in the tab.

In PDF-SDK

The web editor runs the engine as WebAssembly in the page and draws into a canvas you provide.

Web PDF SDK

Last reviewed