PDF.js
summary
A full PDF renderer in JavaScript proves possible: a project with ~15 contributors parses PDFs via XHR (range requests supported), records drawing commands, waits for fonts/images, and paints to canvas with lazy rendering. Native JPEG decode in JS is 10–100x slower, so browser image decoding plus base64 wrapper is used. Type1 fonts undergo type one→type two conversion and embedding via CSS; type‑3 glyphs render slowly. Performance wins come from profiling, inlining, typed arrays and a 50× font‑measure hack; rendering mostly works with some artifacts and printing/selection gaps.
AI-written summary · about
chapters (20)
- 0:00Introduction
- 0:40Agenda
- 1:47Why PDF
- 3:59Video processing
- 5:23PDF file
- 6:39Intermediate presentation
- 7:53Images
- 9:11Fonts
- 11:38Measurements
- 16:24JPEG
- 19:08Strings
- 20:11Arrays
- 20:56Emulation
- 21:16Profilers
- 23:00Dont pause
- 24:29More fun than printing
- 24:52Demo
- 25:18Preview
- 25:37Demo PDF to JS
- 29:49Browser performance
related talks
06mSVG in Custom PDF Templates
59mYou can't do that with JavaScript!
59mYou can't do that with JavaScript!
26mA panoramic tour through HTML5 rendering itself
56mBoosting Web Performance in 2022
30mDon't dream - make the WebAPI of your dreams become real!
28mLeveraging Web APIs for Portable JavaScript Libraries
32mGPU.JS - GPU Accelerated JavaScript
