Renders one page and its text layer with pdf.js's display API (getDocument, PDFPageProxy.render, and TextLayer) and compares the width of every text run with the width pdf.js gives its text item. TextLayer scales each run to that width after measuring it on a hidden canvas whose lang is the text content's: the PDF's /Lang, or "" when the PDF declares none. The runs themselves inherit the page's language. Width ratios far from 1 mean the runs were measured in another font than the one they are drawn in.

Query parameters: lib and worker (pdf.js scripts), css (the stylesheet with pdf.js's .textLayer rules), assets (the directory holding cmaps/ and standard_fonts/), file, page, scale (CSS pixels per PDF point), lang (the page's lang; none removes the attribute), fill (1 gives text content without a language the page's, the workaround), and show (1 shades every run).

Loading…