Rasterization Math in PDF.js
PDF.js draws each page onto a canvas through a render task. Page dimensions are expressed in points, 1/72 inch, and getViewport({scale}) multiplies them. Export resolution therefore follows scale = targetDPI / 72: 150 DPI uses about 2.083, 300 DPI about 4.167. An A4 page at 300 DPI becomes 2480 by 3508 pixels; at 600 DPI it is 4961 by 7016 and consumes four times the memory.
PDF.js needs embedded font programs and CMap files to shape text correctly, especially for CJK. Missing standard-font data triggers fallback metrics, so line lengths and accents can shift. The canvas must be filled white before rendering because PDF pages have no background color; otherwise transparent PNG areas appear black or checkerboard in some viewers.