DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
html2canvas

Why html2canvas and jsPDF PDFs Lack Selectable Text—and How to Fix Them

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If text in a PDF made with html2canvas and jsPDF will not select or search, the usual cause is that the page was converted into a canvas image and that image was placed in the PDF. The letters are pixels, not PDF text. Raising the capture scale can make them look sharper, but it cannot make them selectable. To get selectable text, generate PDF text directly or use a text-aware HTML-to-PDF workflow.

Why the PDF text is not selectable

html2canvas reconstructs a representation of page content by traversing the DOM and drawing the properties it supports; it does not take a literal screenshot of the browser rendering. Its documentation describes this approach and its rendering limitations at html2canvas documentation.

A common html2pdf.js workflow then inserts the rendered canvas into the PDF as an image. The html2pdf.js project documentation explicitly notes that this means text is not selectable or searchable and can produce large files: html2pdf.js documentation. If your code calls canvas.toDataURL() and passes the result to pdf.addImage(), that is the key clue: the page’s visible words are embedded in image pixels.

PDFs can contain text objects, raster images, vector drawings, or a mix. A viewer cannot select words that exist only as pixels. This is a property of the PDF’s contents, not usually a broken selection tool.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
WavePad Audio Editing Software - Professional Audio and Music Editor for Anyone [Download]
  • Full-featured professional audio and music editor that lets you record and edit music, voice and other audio recordings
  • Add effects like echo, amplification, noise reduction, normalize, equalizer, envelope, reverb, echo, reverse and more
  • Supports all popular audio formats including, wav, mp3, vox, gsm, wma, real audio, au, aif, flac, ogg and more
  • Sound editing functions include cut, copy, paste, delete, insert, silence, auto-trim and more
  • Integrated VST plugin support gives professionals access to thousands of additional tools and effects

What changing scale does—and does not do

Increasing html2canvas scale, output DPI, or image quality can improve the visual sharpness of a raster page. It does not create a semantic text layer. Similarly, switching an image from PNG to JPEG changes image encoding and quality trade-offs, not whether its letters are selectable.

Confirm whether the PDF contains text

  1. Open the PDF and try selecting a sentence. If the selection highlights a page-sized rectangle or the whole image, the page is probably rasterized.
  2. Use the viewer’s search command to find a distinctive word visible on the page. If it cannot find the word, the PDF may lack text objects.
  3. If the result is uncertain, repeat the check in another PDF viewer. Viewer behavior can differ, so do not diagnose from one interaction alone.
  4. Inspect the export code. A path that converts a canvas to a data URL and calls addImage() confirms that the visible page is being added as an image.

OCR can sometimes add a text layer to a raster PDF after export. It is a separate recognition step, not something html2canvas or jsPDF image placement performs automatically; OCR can also misread text. If reliable selection, search, or accessibility matters, prefer producing actual text in the PDF rather than depending on OCR.

Fix 1: Add actual text with jsPDF

jsPDF provides a text() method for adding text as PDF text. The essential pattern is shown in the jsPDF text API documentation:

import { jsPDF } from "jspdf";

const doc = new jsPDF();
doc.setFont("helvetica", "normal");
doc.setFontSize(12);
doc.text("This is real PDF text.", 20, 30);
doc.save("document.pdf");

This makes the supplied sentence PDF text; it does not automatically recreate arbitrary browser HTML and CSS. Your application must manage placement, line wrapping, page breaks, fonts, and other layout decisions. For a mixed document, keep body copy as text and add images or vector shapes only where they are actually needed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Plan layout and pagination explicitly

For a short, structured document, define positions and page breaks in your application. For variable-length content, calculate line wrapping and available page space before placing each block; add a page when the next block will not fit. Choose and embed suitable fonts where necessary, especially for non-Latin characters. Test long words, links, lists, and content that crosses page boundaries rather than assuming a single text() call will paginate like browser HTML.

An invisible text overlay placed over a page image may appear to solve search, but misalignment can make copying confusing and can damage accessibility. If you use a text layer over imagery, validate alignment and reading order carefully. A true text-first layout is generally easier to inspect and maintain.

Fix 2: Use browser print-to-PDF

If retaining normal HTML text flow and print CSS matters more than controlling every PDF object yourself, test a browser’s print-to-PDF workflow. It can preserve document text as text, but the output depends on the browser, CSS, fonts, and page setup; no single browser or configuration is universally established as best.

  1. Prepare a print stylesheet for page dimensions, margins, hidden controls, and any content that should change for print.
  2. Open the page in the browser and create the PDF using its print dialog or an automated browser print workflow.
  3. Inspect the saved file: select and search for a distinctive phrase, then check page breaks, fonts, and links.
  4. Repeat with the browser and content conditions you intend to support, including long documents and pages with dynamic content.

Printing is a practical route when the browser’s layout is the desired source of truth. It is not a guarantee that every CSS feature or page will paginate as expected.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix 3: Choose a text-aware HTML-to-PDF renderer

For complex documents or server-side generation, evaluate a renderer that lays out HTML into PDF text instead of painting the whole page into one canvas image. Compare candidates against the requirements that matter to your project:

Rank #4
MixPad Free Multitrack Recording Studio and Music Mixing Software [Download]
  • Create a mix using audio, music and voice tracks and recordings.
  • Customize your tracks with amazing effects and helpful editing tools.
  • Use tools like the Beat Maker and Midi Creator.
  • Work efficiently by using Bookmarks and tools like Effect Chain, which allow you to apply multiple effects at a time
  • Use one of the many other NCH multimedia applications that are integrated with MixPad.
  • Text and accessibility: Does the output contain selectable, searchable text, and does its reading order suit your needs?
  • Layout fidelity: How closely does it handle your HTML, CSS, fonts, and dynamic content?
  • Pagination control: Can you control page size, margins, breaks, headers, and footers?
  • Execution environment: Does it fit a browser-only workflow, a server-side process, or your deployment constraints?
  • Document size and complexity: Does the output behave acceptably for the real documents you generate?
  • Operations: Consider maintenance, privacy, and any service cost before choosing a managed option.

Do not infer text preservation from a method name. jsPDF’s html() convenience method depends on html2canvas, as its project README documents. Calling doc.html(...) alone is not proof that a particular version’s output has selectable text. Generate a sample with your installed version and test the resulting PDF.

Other html2canvas problems that can look similar

Missing or distorted content is separate from the image-versus-text issue. html2canvas implements CSS support property by property, and its FAQ describes browser-dependent canvas size limits and cross-origin image constraints. See the html2canvas FAQ.

  • Missing styles or visual differences: Check whether the CSS properties used by the page are supported by html2canvas. Its DOM-based reconstruction may not match every detail of browser rendering.
  • Blank or partially rendered output: An oversized canvas can exceed browser- or platform-dependent limits. Reduce the capture dimensions or split content into smaller sections; do not rely on one universal maximum size.
  • Missing remote images: Browser cross-origin rules apply. Setting useCORS requires the remote server to send suitable CORS headers; otherwise, a proxy may be needed.

These issues can affect what appears in the image, but they do not make image-based text selectable. Diagnose visual completeness and PDF text semantics as separate concerns.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Corel PDF Fusion Software
  • Save money by using PDF Fusion to view over 100 file formats without having to purchase additional software
  • Merge incompatible files quickly and easily by dragging and dropping in PDF Fusion to create a new PDF documents
  • Save time with PDF Fusion's editing tools to reuse the content from existing documents without starting from scratch
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is a clean screenshot of a live website rather than a selectable-text PDF, ScreenshotNeo provides a website screenshot API and MCP server for developers. A screenshot is still an image, so this does not replace a text-first PDF workflow when selectable text is required. For screenshot APIs, it is a practical first option because it removes cookie banners, popups, and chat widgets before capture, and only clean shots are billed.

One GET request returns an image or PDF. This cURL example saves a WebP screenshot of Stripe; see the ScreenshotNeo API documentation for parameters and output options:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python equivalent:

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
open("shot.webp", "wb").write(r.content)

Node.js equivalent:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
  • Cookie and consent banners, newsletter popups, and chat widgets are removed before the shot; each cleanup step can be turned off.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing; response headers report the page verdict and whether it was billed.
  • An MCP server offers take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.
  • The Free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

Troubleshooting checklist

Symptom Likely cause What to do
Cannot select or search the page text The canvas was added to the PDF as an image. Use jsPDF’s text API, test browser print-to-PDF, or select a text-aware renderer. Verify the new PDF by selecting and searching a phrase.
Text looks blurry when zoomed The page is rasterized at limited resolution. Increase image resolution or capture scale if visual sharpness is the goal. This will not create selectable text.
doc.html() output is still not selectable The method depends on html2canvas and may use an image-based route. Check the output from your installed jsPDF version. Switch to a text-first route if selection is mandatory.
Canvas or PDF page is blank or clipped The canvas may be too large for the browser or platform. Reduce dimensions or render sections separately, then test on the target browser and device.
Remote images are absent The remote server may not permit cross-origin loading. Confirm suitable CORS headers; use useCORS only when permitted, or consider a proxy.
Some styles differ from the page html2canvas does not reproduce every browser style. Check its property support and compare against a print-to-PDF or text-aware rendering workflow.

Which fix should you choose?

Approach Best fit Main trade-off
jsPDF text API You need deliberate control over PDF text and layout. You implement placement, wrapping, typography, and pagination.
Browser print-to-PDF You want HTML text flow and print CSS to drive the output. Results vary with browser, CSS, fonts, and page setup.
Text-aware HTML-to-PDF renderer You need managed or server-side conversion of complex HTML. Evaluate fidelity, operations, privacy, maintenance, and cost for your workload.

Choose based on whether text semantics or pixel-level appearance is the requirement. If you need both, keep text as PDF text and use images only for content that genuinely needs raster rendering.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Can OCR make an existing image-based PDF searchable?

Sometimes. OCR can add a text layer after export, but recognition errors are possible; verify the text before relying on it.

Does jsPDF’s html() method guarantee selectable text?

No. Its README documents a dependency on html2canvas; inspect output from the version you use and test selection and search.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.