Recommended Free Tools
There is no documented Puppeteer PDF option that turns off hyperlink annotations. For links created by HTML anchors, remove or replace their href attributes in the document state used for printing, then generate the PDF and check the result in your intended PDF viewer. This keeps the link text visible while removing its destination from the print DOM. The workaround is not a documented Puppeteer feature, so verify it against your Chromium version and page.
Does Puppeteer have a switch to disable PDF hyperlinks?
No such switch appears in Puppeteer’s documented PDFOptions in version 25.12.0. That interface lists PDF settings such as format, margin, printBackground, pageRanges, tagged and waitForFonts, but not a hyperlink-off or annotation-suppression setting. The PDFOptions reference is the place to check when upgrading, since available options can change.
Page.pdf() generates output using the print CSS media type. Puppeteer’s documented way to use screen media instead is page.emulateMediaType('screen') before calling page.pdf(); that changes the media used to render the page, not a documented setting for disabling links. See the Page.pdf() method and PDF generation guide.
For ordinary HTML links, the practical fix is therefore to change the DOM before printing, rather than styling the link to look inactive. If the apparent link is only URL-looking text, first determine whether the PDF contains an annotation at all; a viewer may be adding the clickable behavior itself.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
- EDIT text, images & designs in PDF documents. ORGANIZE PDFs. Convert PDFs to Word, Excel & ePub.
- READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.
- CREATE, COMBINE, SCAN and COMPRESS PDFs
- FILL forms & Digitally Sign PDFs. PROTECT and Encrypt PDFs
- LIFETIME License for 1 Windows PC or Laptop. 5GB MobiDrive Cloud Storage Included.
Remove anchor destinations before printing
This example removes href attributes from anchors in the current page, keeps their text and other markup, and writes the resulting PDF to disk. It assumes Puppeteer has already navigated to the target page and that the page content you want is present.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle0' });
await page.evaluate(() => {
document.querySelectorAll('a[href]').forEach((anchor) => {
anchor.removeAttribute('href');
});
});
await page.pdf({ path: 'page.pdf', format: 'A4' });
} finally {
await browser.close();
}
})();
Replace https://example.com with the page you control or are authorized to capture. networkidle0 is one possible navigation wait condition, not a guarantee that every site has finished rendering: pages with persistent network activity or delayed client-side content may need a different readiness condition. Puppeteer’s PDF generation guide documents PDF generation and font waiting; the DOM transformation above is an implementation workaround, not a documented Puppeteer PDF option.
Keep the live page unchanged when needed
Removing attributes mutates the page. If subsequent work in the same page needs the original links, save and restore each original destination around PDF generation. The example below records only anchors that have an href attribute; it restores that attribute in a finally block even if PDF generation throws.
const originalLinks = await page.evaluate(() => {
const saved = [];
document.querySelectorAll('a[href]').forEach((anchor) => {
saved.push({
anchor,
href: anchor.getAttribute('href'),
});
anchor.removeAttribute('href');
});
return saved;
});
try {
await page.pdf({ path: 'page.pdf', format: 'A4' });
} finally {
await page.evaluate((saved) => {
saved.forEach(({ anchor, href }) => {
if (anchor.isConnected) anchor.setAttribute('href', href);
});
}, originalLinks);
}
In Puppeteer, values returned from page.evaluate() are serialized; DOM element handles are not a suitable way to send an array of nodes back and forth like this. For robust restoration, perform the save, mutation, PDF, and restoration together within one page evaluation only if the PDF operation can be coordinated there, or use a simpler print-only page/clone strategy. A reliable practical implementation is to capture each anchor’s stable identifier and original attribute in Node, mutate the live DOM, print, and restore by identifier. If the page has no stable identifiers, use a print-only document state rather than relying on positional selectors across DOM changes.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesFor example, if the page content can be reloaded after printing, the least error-prone isolation is often to navigate a separate page instance to the same URL, remove destinations there, and print that page. This avoids permanently changing the original browser page. Make sure any authentication, cookies, injected content, or other state needed by the page is available in the print instance.
Make the transformation cover the content being printed
Links added after navigation
The selector runs against the DOM at the moment page.evaluate() executes. If the application inserts links later, wait for the relevant content or run the transformation after it has appeared. A fixed delay can be brittle; where possible, wait for a selector that identifies the content you need before removing destinations.
Rank #2
- Edit PDFs with Ease. Modify text, images, and layouts directly within your PDF documents.
- Convert & Organize. Export PDFs to Word, Excel, or ePub, and organize files with ease.
- Read & Annotate. Enjoy intuitive reading modes and powerful tools to comment, highlight, and mark up PDFs.
- Create & Manage PDFs. Create new PDFs, combine multiple files, scan documents, and compress for easy sharing.
- Fill & Sign Forms. Complete forms and digitally sign documents with secure e-signature tools.
Frames and embedded content
The example selects anchors in the page document. It should not be assumed to transform links inside every frame or other separately rendered content. If the output includes framed content, check that content independently and verify the generated PDF; the cited Puppeteer API documentation does not promise this workaround across every frame or content type.
Preserve text, change the destination, or remove the link?
- Keep text, remove destination: remove
href, as in the example. The anchor’s visible text remains in the HTML. - Keep a destination for some links: target only the anchors you intend to neutralize, using a selector or condition that matches your page’s structure. Avoid removing every
hrefif some links must remain clickable. - Remove an anchor entirely: do this only if its text should also disappear. Removing the element is different from disabling its destination.
Why CSS alone is not a dependable fix
Rules such as pointer-events: none, removing underlines, or setting link colors to match surrounding text affect presentation or interaction in a rendered page. Puppeteer’s documentation for Page.addStyleTag() establishes that it can inject CSS; it does not establish that CSS suppresses PDF link annotations. Do not treat visual styling or disabled pointer interaction as proof that a PDF destination is gone. Change the link target in the print DOM and inspect the PDF instead.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Verify what the PDF actually contains
- Generate the PDF after applying the DOM change.
- Inspect its link annotations with a PDF inspection tool available in your workflow.
- Open the same PDF in another viewer if a URL still appears clickable.
- If the PDF contains an annotation, trace it to its source and ensure the relevant anchor destination was removed before printing.
- If no annotation is present but one viewer still reacts to URL-looking text, investigate that viewer’s behavior rather than assuming Puppeteer embedded a link.
A Stack Overflow community answer from 2019 raises viewer-generated clickability of URL-like text as a possible explanation, but it is a diagnostic lead, not a universal or authoritative statement about PDF viewers. The distinction matters: removing an HTML anchor destination can address a link embedded from that anchor, but it cannot necessarily control interactions a viewer creates from plain text.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshooting
The text is still visible and clickable
Visible text is expected when only href is removed. Check the PDF annotations first. If an annotation remains, confirm the link was present in the document you printed and that the mutation ran after the page created it. Check the exact frame or content region shown in the PDF. If there is no annotation, compare viewers to see whether the viewer recognizes the visible text as a URL.
The links look plain but still open
Appearance is not a reliable test. Link color, underline, and pointer behavior do not establish whether a destination is embedded. Remove or rewrite the relevant href before printing, then inspect annotations.
Some links work and others do not
That can be intentional if the selector targets only a subset, or it can indicate that some anchors were added after the transformation or live in content the selector did not reach. Inspect the printed page structure and adjust the timing or targeting rather than broadening the selector without checking which destinations should remain.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallRank #3
- EVERY PDF TOOL UNLOCKED - 30+ tools in one app: edit text and images, convert, merge, split, compress, sign, OCR, redact, watermark, batch process, and more. No feature gates, no upsells, nothing held back.
- PAY ONCE, OWN FOREVER — A one-time purchase, not a subscription. Other apps runs $240/year — Scrivar is yours for life, with free updates included.
- UNLIMITED eSIGN, BUILT IN — Send contracts and forms for signature and track every step. Recipients sign in their browser with no account or app needed. Replace DocuSign and save hundreds a year.
- PC, MAC, AND WEB — Install on any Win 10/11 PC or macOS 11+ Mac (Intel or Apple Silicon), or work in your browser at scrivar.com. Same tools, same account, everywhere you work.
- OCR + FULL OFFICE CONVERSION — Turn scanned documents into searchable, selectable text, and convert PDFs to and from Word, Excel, and PowerPoint with formatting kept intact.
The page’s behavior breaks after removing links
Some scripts may rely on anchors or their attributes. Avoid changing the production page state used by later tasks: print from a separate page or restore original attributes after generating the PDF. If removing href still disrupts page behavior, use a controlled print-only document state and test that state against the page’s scripts.
A CSS workaround has no effect
That is not surprising: the official documentation cited here does not document CSS link styling as a way to suppress PDF annotations. Use a DOM-level change to destinations and verify the output.
Or skip the browser setup
ScreenshotNeo is a screenshot API and MCP server, not a drop-in replacement for Puppeteer’s print-DOM workaround when the requirement is specifically to keep PDF text but remove its link annotations. It can be useful when the deliverable you need is a clean page screenshot rather than a PDF. One GET request returns a PNG, JPEG, WebP, or PDF; the request below uses the documented API endpoint and saves the response as WebP. See the ScreenshotNeo API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
ScreenshotNeo accepts cookie/consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000. See ScreenshotNeo for the service details. Sign up free for 1,000 screenshots a month, with no card required.
Frequently Asked Questions
Does setting emulateMediaType('screen') remove PDF hyperlinks?
No. It selects screen rather than print CSS media for rendering; Puppeteer’s documentation does not identify it as a link-annotation control.
Will removing href remove the visible link text?
No. Removing the attribute leaves the anchor’s text and content in place; removing the anchor element itself would also remove its content.
Quick Recap
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.

