PDF

How to Turn a Web Page or HTML Into a PDF With Selectable Text

July 11, 2026 ยท 7 min read

When you save a web page as a PDF, you get one of two very different files that look identical until you try to use them. One is made of real, selectable text you can search, copy, and highlight. The other is essentially a screenshot pasted onto a page: it shows the words but the computer sees only pixels. Ctrl+F finds nothing, you cannot copy a sentence, and it turns blurry the moment you zoom in.

The good news is that getting the searchable kind is usually the easy default. To convert any HTML or live page into a true text PDF, let a real rendering engine lay out the page rather than photograph it. The fastest route on almost any device: open the page, press Ctrl+P (Cmd+P on a Mac), and choose Save as PDF. That produces selectable text. The trap is any workflow that turns the page into an image first, then wraps that image in a PDF.

Below, you will learn how to tell the two kinds apart in about three seconds, when the image kind is actually the one you want, and how to reliably get selectable text from raw HTML or a live URL, whether you are doing it by hand or in code.

The two kinds of PDF, and why they look identical

Every PDF page is a canvas that can hold two very different things. A text-based PDF stores the actual characters as text objects with an embedded or referenced font, positioned on the page. The reader knows that the shape in the top corner is the letter A. An image-based PDF stores a single flattened picture of the page: a grid of colored dots that happens to resemble words. The reader has no idea any letters exist.

On screen at 100 percent zoom, the two can be indistinguishable. The difference only shows up when you interact with the file. In a text PDF you can drag-select a paragraph, hit Ctrl+F to jump to a word, and copy a quote straight out. In an image PDF, your cursor slides across the page selecting nothing, search returns no results, and copy gives you an empty clipboard.

There is also a size and sharpness gap. A text-based PDF of a long article is often around 100 to 300 KB, because text and font data are compact. An image-based capture of that same page can run 2 to 6 MB, because it is storing every pixel. Zoom past roughly 150 percent and the image PDF starts to look soft and jagged, while text stays razor sharp at any magnification because it is redrawn, not enlarged.

  • Text-based PDF: real characters, searchable, copyable, small, sharp at any zoom, readable by screen readers.
  • Image-based PDF: a flat picture of the page, not searchable, not copyable, larger, blurry when zoomed, invisible to assistive tech.
  • Both can look identical at normal size, so you often do not notice which one you have until it fails you.

The three-second test: which kind do you have?

You do not need any special software to check a PDF you already have. Open it in any viewer and run one of these quick tests. If a test works, you have real text. If it does nothing, you have an image.

The fastest single check is search: press Ctrl+F and type a word you can clearly see on the page. If the viewer highlights it, the text is real. If it insists there are no matches for a word that is obviously right there, the page is an image.

The same logic applies before you commit to a conversion method. If a tool or workflow ever shows you a preview and you cannot select the words in it, whatever it exports will not be searchable either.

  • Search: press Ctrl+F, look for a visible word. A highlight means real text.
  • Select: try to drag-highlight a sentence. A blue selection means real text; nothing selectable means an image.
  • Copy: highlight and copy a line, then paste it somewhere. Real words mean a text PDF; an empty or garbled paste means an image.
  • Zoom: enlarge to 300 percent. Crisp edges mean vector text; blocky, soft pixels mean an image.

When you actually want each kind

Text-based is the right default for almost everything, but the image kind is not a mistake to always avoid. It has genuine uses. The question is whether you care more about reusing the content or about freezing exactly how it looked.

Choose based on what you will do with the file next, not on which button is easier to press.

SituationBest PDF typeWhy
Reports, invoices, or articles you will searchText-basedCtrl+F works, text copies out, file stays small
Accessibility and screen readersText-basedAssistive tech reads real characters, not pixels
Anything you will re-edit or pull data fromText-basedEnables copy and clean extraction with no OCR
A pixel-perfect design proof or styled receiptImage-basedCaptures the exact look, fonts, and spacing as rendered
Archiving how a page looked on a given dayImage-basedFreezes the rendering with no reflow surprises later
A page whose heavy CSS or JavaScript prints badlyImage-based (fallback)A snapshot sidesteps a broken print layout

The fastest way: your browser's Print to PDF

The Print to PDF feature built into Chrome, Edge, Firefox, and Safari is the most reliable way to get a text-based PDF, and it is free and already installed. It works because the browser is a full rendering engine: it lays the page out and writes the characters into the PDF as real text, fonts and all. It does not take a screenshot.

Open the page you want, press Ctrl+P (Cmd+P on a Mac), and in the Destination or Printer dropdown choose Save as PDF (in some browsers it is labelled Microsoft Print to PDF or Export to PDF). Set the paper size and margins, then save. The result is searchable and, in Chrome and Edge, keeps your hyperlinks clickable.

One setting trips almost everyone up. By default, browsers strip background colors and background images to save ink, so a page with a dark header or colored panels can print as plain white. In the print dialog, expand More settings and turn on Background graphics (Safari calls it Print backgrounds). Also preview every page: fixed headers, sticky bars, and cookie banners sometimes overlap content or repeat, and it is easier to close them before printing than to fix the PDF afterward.

  • Ctrl+P or Cmd+P, then choose Save as PDF as the destination.
  • Turn on Background graphics if the page has colored or dark backgrounds.
  • Check the page preview for cut-off content, repeated headers, or stray banners.
  • Use the Landscape option for wide tables so columns are not clipped.

Converting raw HTML or a URL with an online tool

Print to PDF is perfect when you are looking at the page in a browser. But sometimes you have raw HTML as text, such as an email template, a generated invoice, or a code snippet, and no live page to open. Or you want to convert a URL in bulk without clicking through each one. That is where an online HTML-to-PDF converter earns its place: you paste the markup or the address and it renders a proper text-based PDF for you.

The important thing is to pick a converter that renders the HTML rather than one that screenshots it. A renderer produces selectable text; a screenshot service produces the image kind. If the tool offers an image export as well, that is a feature, not a flaw, as long as the PDF path gives you real text. You can convert HTML to a selectable-text PDF online and confirm the result with the three-second search test before you rely on it.

Two practical cautions when converting a live URL rather than pasted HTML. Content that sits behind a login, a paywall, or a cookie wall may not be reachable by the converter, so it captures the gate instead of the article. And pages that build themselves with JavaScript after loading, or that lazy-load images as you scroll, can come out with blank spaces if the converter grabs the page before everything has settled.

For developers: headless Chrome, Puppeteer, and wkhtmltopdf

If you are generating PDFs from a server or a build step, the same principle holds: use a real rendering engine and you get text-based output for free. All three common options below produce selectable text, not screenshots.

Headless Chrome is the simplest one-liner. Running chrome --headless --print-to-pdf=out.pdf followed by a URL prints the rendered page to a text-based PDF, the same engine as the browser dialog. Puppeteer wraps this in Node with page.pdf(), which returns a text PDF and gives you control over paper size, margins, and headers. The one flag people forget is printBackground, which defaults to false, so pass printBackground: true to keep background colors and images. wkhtmltopdf is a long-standing standalone binary that converts an HTML file or URL directly; it uses an older WebKit engine, so very modern CSS such as flexbox or newer grid features may render differently, but it still emits real text.

For JavaScript-heavy pages, wait for the content to finish before you capture. In Puppeteer, load the page with a waitUntil setting like networkidle0 and, if a specific element appears late, wait for that selector too. That single step prevents most of the blank-section and missing-image problems that make people wrongly blame the converter.

  • Headless Chrome: chrome --headless --print-to-pdf=out.pdf https://example.com produces text output.
  • Puppeteer: await page.pdf({ format: 'A4', printBackground: true }) keeps backgrounds and stays selectable.
  • wkhtmltopdf: converts a file or URL directly; older engine, so verify modern CSS renders as expected.
  • Always wait for the page to finish rendering before printing to avoid blank or half-loaded sections.

Common problems and how to fix them

Most HTML-to-PDF complaints trace back to a handful of predictable issues, and each has a clean fix. Working through this list will resolve the large majority of ugly or broken exports.

If your file ends up unexpectedly large or refuses to become searchable no matter what you try, that is the tell-tale sign it went through an image-based path somewhere. Switch to a rendering method, or if you must keep an image PDF, you can still compress the resulting PDF to bring the size down before sending it.

  • Backgrounds missing: enable Background graphics in the print dialog, or set printBackground: true in code.
  • Content cut across page breaks: add CSS such as break-inside: avoid (or page-break-inside: avoid) to headings, tables, and cards so they are not split.
  • Web fonts not showing: give fonts time to load before printing, or the PDF falls back to a default typeface.
  • Blank spaces where images should be: lazy-loaded images need the page scrolled or fully loaded first; wait for network idle in code.
  • Text not selectable: you have an image PDF; re-do it with Print to PDF or a rendering converter.
  • File too large: it is almost certainly image-based or packed with high-resolution images; convert to text or compress it.

Frequently Asked Questions

Because that PDF is image-based: it stores a flat picture of the page rather than real characters, so the reader sees pixels, not letters. This happens when a page is screenshotted or rasterized before being wrapped in a PDF. To fix it, recreate the file with a method that renders the HTML, such as your browser's Print to PDF or an HTML-to-PDF converter that outputs text. There is no setting that unlocks selection on an existing image PDF; you have to regenerate it or run OCR.

Yes. The browser's Print to PDF uses the same engine that renders the page, so it writes the actual characters into the file as real text. The result is searchable and copyable, and in Chrome and Edge the hyperlinks usually stay clickable too. Just remember to turn on Background graphics in the print settings if the page has colored or dark backgrounds, since those are stripped by default.

For a live page you are already viewing, the simplest route is Ctrl+P (or Cmd+P) and Save as PDF. For raw HTML that has no live page, such as an email template or a generated invoice, paste the markup into an online HTML-to-PDF converter that renders it. For a URL you want to convert without opening it, most converters accept an address directly, though pages behind a login or built by JavaScript can be unreliable to capture that way.

Partly. Optical character recognition (OCR) can scan the image and add an invisible text layer behind it, which makes the file searchable and copyable. It is genuinely useful, but it is a best-effort recognition step, not a perfect conversion: unusual fonts, low resolution, and complex layouts can produce errors. Whenever you have the choice, generating a true text-based PDF from the start is far more reliable than OCR-ing an image afterward.

Browsers strip background colors and background images by default to save ink when printing, so a page with a dark header or colored panels can export as white. In the print dialog, expand More settings and enable Background graphics (Safari calls it Print backgrounds). If you are generating PDFs in code with Puppeteer, pass printBackground: true, since it also defaults to off.

In a text-based PDF, they usually are. When the browser or a rendering converter lays out the page, it can carry your links through as live annotations, so a reader can click them in the finished PDF. In an image-based PDF they cannot be clickable, because the whole page is a single flat picture with no link data. If working links matter to you, that is one more reason to choose a rendering method over a screenshot.

Related Tools