DEV Community

yue xing
yue xing

Posted on

After converting a PDF to a webpage, can you still select and search the text

Converting a PDF to a webpage, my biggest worry was the text turning into an image — then you can't select, copy or search it, and converting is pointless for note-taking. Testing it out, a good PDF-to-HTML stays selectable and searchable, and understanding how tells you when it won't.

The result first: the converted webpage lets you select text with the mouse, hit it with Ctrl+F, and copy-paste. It does this with a "two layers stacked" trick — what you see is graphics rebuilt from PDF coordinates (vector outlines of the text, so it looks like the original), and over that sits an invisible, transparent selectable-text layer. Your selecting, searching, copying hits that transparent text; your eye sees the graphics beneath. Aligned and stacked, you get "looks like the original, yet selectable and searchable".

PDF to HTML operation page

A nice detail: it handles even Type 3 glyphs. Type 3 is a PDF font defined by drawing instructions; plenty of tools just treat it as an image and lose selectability. Here it's rebuilt from its original drawing instructions (CharProcs) into reusable graphic symbols, then the transparent text layer over it — so even these special glyphs stay selectable. On a formula- and symbol-heavy PDF the difference is stark: selectable versus view-only is a huge gap for notes.

But a boundary worth knowing: whether the font can be packaged into the webpage depends on the font's own permission. It only inlines fonts marked "embedding allowed"; ones whose license forbids embedding aren't force-packed. So a rare PDF using a restricted font may display slightly differently on another computer (but selecting and searching still work, since those ride on the transparent text layer, not the font). That's normal respect for font licensing, not a bug.

And the big one for us students: scanned PDFs are the exception. If your PDF is scanned or photographed from paper, each page is already an image with no text data inside — converting it to a webpage keeps it an image, unselectable and unsearchable, not the tool's fault, the source simply has no text. To make a scan selectable you need OCR first, a separate step. Easy test: if you can select text in the original PDF, you can after converting; if you can't (one drag selects a whole page), it's an image and stays one. It also doesn't claim "perfect / pixel-exact" — complex graphics and restricted fonts have limits, flagged on the page. So for printed, text-based PDFs (papers, lecture notes, reports), convert away — selectable, searchable, copy straight into your notes. Tool is ImgIng (imging.ai).

Top comments (0)