Skip to main content

PrintPruna (2026)

Chrome and Firefox extension that lets you mark HTML blocks on a page to clean it up before printing to PDF.

PrintPruna (2026)

PrintPruna (2026)

Chrome and Firefox extension that lets you mark HTML blocks on the current page to clean it up before printing to PDF. No server, no data leaving the browser: everything happens inside the same tab.

Available on the Chrome Web Store.

What does it do?

Clicking the extension icon opens a small menu with three options:

  • Select: marks the block you want to keep; the rest of the page is hidden. The selected block is resized (~90% width, centered) so it doesn't lose readability if it depended on a flex/grid layout with siblings now hidden.
  • Remove: marks a specific block and makes it disappear, leaving the rest of the page intact. It can be used repeatedly to remove more than one block.
  • Print: opens the browser's print dialog directly (window.print()), without going through the keyboard. Useful on pages that block Ctrl+P/Cmd+P with JavaScript.

In "Select" and "Remove" modes, the cursor turns into a crosshair and elements are highlighted on hover (blue for "Select", red for "Remove"). Click the desired element to apply the action, or press Esc at any time to exit marking mode without making any changes. To restore the page's original state, just reload it (F5).

Bypassing the Ctrl+P block

Some pages block the print shortcut with JavaScript to stop users from printing or saving the content as a PDF. Whenever any menu option is activated, PrintPruna also installs a keydown listener at the window level in the capture phase, ahead of any listeners the page has attached to document. Since the capture phase travels window → document → ..., the extension's listener always runs first and stops propagation without calling preventDefault(), letting the browser carry out its default action.

It's a best-effort mitigation: if the page attaches its listener directly to window before the extension is injected, this method can't beat it. For those cases there's the menu's "Print" option, which calls window.print() from the extension's "isolated world" and remains unaffected even if the page has overwritten window.print.

Architecture

Manifest V3 shared between Chrome and Firefox, with only two permissions (activeTab, scripting):

manifest.json     Manifest V3, shared between Chrome and Firefox
src/popup.html    Icon menu with the "Select", "Remove" and "Print" options
src/popup.js      Injects the content script (if needed) and sends the chosen mode
src/content.js    Hover, block selection/removal logic
src/content.css   Hover highlight and marking cursor styles

Installing in developer mode

Chrome / Edge / Brave: open chrome://extensions, enable "Developer mode" and click "Load unpacked", selecting the project folder.

Firefox: open about:debugging#/runtime/this-firefox and click "Load Temporary Add-on", selecting the manifest.json file. The load is temporary and is lost when the browser closes; a permanent install would require signing the extension via addons.mozilla.org.

Tech stack

  • Manifest V3
  • Chrome Extensions API (activeTab, scripting)
  • Vanilla JavaScript, no dependencies

Source code: github.com/albertsarle/print-pruna

Technologies

Manifest V3 (shared Chrome/Firefox)Chrome Extensions API (activeTab, scripting)Vanilla JavaScript

Achievements

  • Dependency-free extension, compatible with Chrome, Edge, Brave and Firefox from the same manifest
  • Reusable "Remove" mode, applied repeatedly to clean up several blocks in a row
  • Ctrl+P block bypass: window.print() called from the extension's "isolated world", unaffected by the page
  • Capture-phase keydown listener that beats page scripts trying to block the print shortcut