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

Use jsPDF to build the document, generate a temporary Blob URL, and pass that URL to window.open() from the same user action that started the operation. The essential pattern is:

import { jsPDF } from 'jspdf';

function openPdfPreview() {
  const doc = new jsPDF();
  doc.text('Hello world!', 10, 10);

  const blobUrl = doc.output('bloburl');
  const previewTab = window.open(blobUrl, '_blank');

  if (!previewTab) {
    console.warn('Allow popups or use the PDF download link.');
  }
}

Attach that function to a real button. A browser may block a tab opened after a long asynchronous operation, so the call to window.open() must remain tied to a user gesture. The generated PDF is normally displayed by the browser’s built-in PDF viewer, although exact behavior depends on browser settings, extensions and version.

What the jsPDF workflow does

There are four steps:

  1. Create a jsPDF instance and add content.
  2. Ask jsPDF for a Blob URL with output('bloburl').
  3. Open that URL in a new browsing context with window.open(blobUrl, '_blank').
  4. Check the return value and provide a fallback if it is null.

bloburl creates an object URL backed by URL.createObjectURL when available. It is temporary and remains usable until you revoke it or the document is unloaded.

Complete button-based example

Install jsPDF with your package manager:

npm install jspdf

Then import it in your application and connect the handler to a button:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Amazon Kindle 16 GB (2024 model) - Light and compact, with fast page turns, and high contrast ratio - Matcha
  • The lightest and most compact Kindle - Now with a brighter front light at max setting, higher contrast ratio, and faster page turns for an enhanced reading experience.
  • Effortless reading in any light - Read comfortably with a 6“ glare-free display, adjustable front light—now 25% brighter at max setting—and dark mode.
  • Escape into your books - Tune out messages, emails, and social media with a distraction-free reading experience.
  • Read for a while - Get up to 6 weeks of battery life on a single charge.
  • Take your library with you – 16 GB storage holds thousands of books.
import { jsPDF } from 'jspdf';

const previewButton = document.querySelector('#preview-pdf');
const fallback = document.querySelector('#pdf-fallback');

previewButton.addEventListener('click', () => {
  const doc = new jsPDF({
    orientation: 'portrait',
    unit: 'mm',
    format: 'a4'
  });

  doc.setFontSize(18);
  doc.text('Invoice preview', 20, 25);
  doc.setFontSize(11);
  doc.text('Generated in the browser with jsPDF.', 20, 35);

  const blobUrl = doc.output('bloburl');
  const previewTab = window.open(blobUrl, '_blank', 'noopener');

  if (!previewTab) {
    fallback.hidden = false;
    fallback.href = blobUrl;
    fallback.textContent = 'Open the generated PDF';
    previewButton.setAttribute('aria-describedby', 'popup-status');
    document.querySelector('#popup-status').textContent =
      'The browser blocked the preview tab. Use the PDF link below or allow popups for this site.';
  } else {
    previewTab.opener = null;
  }
});

Example markup:

<button id="preview-pdf" type="button">Preview PDF (opens in new tab)</button>
<p id="popup-status" role="status"></p>
<a id="pdf-fallback" hidden download="generated.pdf"></a>

The noopener feature and clearing opener prevent the new page from retaining a scriptable reference to the opener. Keep the visible label explicit: users should know that activating the button changes browsing context.

Why window.open() returns null

Modern browsers apply strict popup policies. A new tab or window is generally allowed only when the call occurs directly inside a trusted user action such as a click. If your code waits for a timer, a network request, a large rendering task or another promise before opening the context, the browser can classify it as unsolicited and return null.

Open first when generation is asynchronous

If producing the PDF requires asynchronous work, open a blank context synchronously, then navigate it after the PDF is ready. This preserves the user gesture while still allowing asynchronous generation:

import { jsPDF } from 'jspdf';

async function buildPdfData() {
  // Replace this with your asynchronous data loading.
  const response = await fetch('/api/invoice');
  const invoice = await response.json();

  const doc = new jsPDF();
  doc.text(`Invoice ${invoice.number}`, 20, 25);
  doc.text(`Total: ${invoice.total}`, 20, 35);
  return doc.output('bloburl');
}

document.querySelector('#async-preview').addEventListener('click', async () => {
  const previewTab = window.open('', '_blank', 'noopener');

  if (!previewTab) {
    document.querySelector('#popup-status').textContent =
      'The browser blocked the preview. Allow popups and try again.';
    return;
  }

  previewTab.document.title = 'Preparing PDF preview';
  previewTab.document.body.textContent = 'Preparing PDF…';

  try {
    const blobUrl = await buildPdfData();
    previewTab.location.href = blobUrl;
  } catch (error) {
    previewTab.document.body.textContent = 'Could not generate the PDF.';
    console.error(error);
  }
});

This blank-tab technique is a practical application of the documented user-gesture rule. Verify it in the browsers your application supports: popup handling, opener behavior and PDF viewers can vary.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
ECOPAD 10.1 Inch Tablet, Android 15 Tablets 12GB(4+8) RAM / 64GB ROM / 1TB SD Card Expansion, 1280x800 IPS HD Touchscreen, 6000mAh Battery, Bluetooth 5.0, Dual Cameras, GMS, Dual Band WiFi, Black
  • Latest Android Tablet - This android tablet features a quad-core processor, android 15 OS and a 10.1" IPS screen, its smooth operation enables seamless video playback, gaming, and multitasking.
  • 12GB RAM/64GB ROM + 1TB Expand - With ample storage capacity that can be expanded up to 1TB via SD card (sold separately), you can confidently store all your photos, videos and files without concerns.
  • IPS Display & Dual Camera - Equipped with 10.1" IPS 1280x800 HD screen, 2.0MP front camera/8.0MP rear camera, this android 15 tablet offers you a delightful experience while watching movies, reading books, or making video calls.
  • Long Battery Life - Built-in 6000mAh lithium battery, this android tablet provides up to 8 hours of uninterrupted video playback, enabling you to use it for longer periods without any interruptions.
  • Worry-Free Service - We offer comprehensive support to put your mind at ease. Our warranty lasts for 1 year. If you have any questions, please don't hesitate to contact us. We will respond promptly and assist you in resolving any issues.

Managing the Blob URL lifecycle

jsPDF’s documentation states that the developer is responsible for calling revokeObjectURL. Do not revoke the URL immediately after window.open(); the PDF viewer may not have loaded it yet.

Simple cleanup

If the preview is short-lived, retain the URL and revoke it after a conservative delay:

const blobUrl = doc.output('bloburl');
const tab = window.open(blobUrl, '_blank', 'noopener');

if (tab) {
  // Choose a delay appropriate to your application and document size.
  setTimeout(() => URL.revokeObjectURL(blobUrl), 60_000);
}

A timeout is only a basic policy; it cannot know when a user has finished reading. For longer-lived previews, keep the URL in application state and revoke it when the preview component is closed or unmounted. If you revoke too early, the viewer can show a blank page or a load error.

Creating the URL yourself from a Blob

Use output('blob') when you need explicit control:

const pdfBlob = doc.output('blob');
const blobUrl = URL.createObjectURL(pdfBlob);
const tab = window.open(blobUrl, '_blank', 'noopener');

if (!tab) {
  const link = document.createElement('a');
  link.href = blobUrl;
  link.download = 'generated.pdf';
  link.textContent = 'Download generated PDF';
  document.body.append(link);
}

Revoke this URL using the same lifecycle rules. A Blob URL is not a permanent public address and normally cannot be shared with another user or server.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
HNVHNV Android Tablet 7 Inch Tablet, E-Reader, 6GB RAM 32GB ROM 1TB Expansion, Quad-core Processor, Dual Camera, WiFi, Bluetooth, Parental Control (Pink)
  • 【Android Tablet】Equipped with the latest Android system, it has stronger compatibility, faster response speed and smoother operation. It is GMS certified, pre-installed with Google Play, and supports social applications such as Facebook, Twitter, YouTube, and TikTok. It is very suitable for watching videos, online chatting, reading e-books, etc.
  • 【Smooth Performance】This tablet is equipped with a 1024x600 IPS touch screen, Unisoc SC7731E quad-core processor, 6GB memory (2GB + 4GB virtual memory), 32GB ROM, and the tablet storage space can be expanded to 1TB using an SD card, which can store everything you need.
  • 【Powerful Function】This is a cost-effective tablet. Affordable price and excellent configuration. Equipped with 2MP+5MP dual cameras, Bluetooth, 5G/2.4G dual-band WiFi, FM radio, speakers, 3.5mm headphone jack, etc. Suitable for reading, photography, video, music, etc., meeting most of your daily needs.
  • 【Child-friendly functions and parental control】Pre-installed Google Kids Space application, providing rich content suitable for different age groups. Equipped with a parental control mode, it allows you to filter content, set educational goals, and manage screen time limits based on your child's age, providing a safe use environment that does not require constant supervision.
  • 【Portable & Lightweight & Protective Case】​​- The tablet body is slim and lightweight, easy to carry. It can be easily put into a bag, backpack or even back pocket. In addition, the durable and environmentally friendly protective case can effectively protect your tablet from drops, scratches and dust. You can use it anywhere you want.

Preview versus download: choose the right jsPDF output

Method Result Best use Important caveat
output('bloburl') or output('bloburi') Temporary URL for the generated PDF Open a browser preview with window.open() You must eventually revoke the object URL
output('dataurlnewwindow') Asks jsPDF to open a window containing an iframe with a data URL Quick browser-only preview Still subject to popup blocking
output('blob') A Blob object Custom URL, upload or download workflow You manage the object URL if you create one
save('generated.pdf') Downloads the file Explicit download action It is not a preview; jsPDF documents it as an alias of output('save', filename) using FileSaver.js
output('pdfjsnewwindow') Opens a PDF.js-based viewer route Applications that have configured the required PDF.js viewer path Not a universally configured default

For a normal inline browser preview, bloburl gives the clearest control over popup failure, fallback links and cleanup.

Handling popup failure accessibly

  • Always test the return value from window.open().
  • Show a normal link or download control if it is null.
  • Use a live status region such as role="status" to explain what happened.
  • Label the activating control “Preview PDF (opens in new tab)” rather than disguising an action as href="#".
  • Use a separate user gesture for each tab you open; browsers can reject multiple popups from one click.

A successful call does not guarantee the same visual result everywhere. Browser PDF preferences, extensions and built-in viewers determine whether the file appears inline, downloads automatically or is handed to another application.

Troubleshooting

The new tab is blocked

Cause: the call happened after asynchronous work, in a timer, or outside a trusted click. Fix: move window.open() into the click handler, or open a blank tab first and navigate it after generation. Check for a null return and provide a link.

The tab opens but is blank

Cause: the object URL was revoked too soon, PDF generation failed, or the browser viewer rejected the data. Fix: delay revocation, catch generation errors, inspect the Blob, and try the explicit output('blob') plus URL.createObjectURL route.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Amazon Kindle Scribe Colorsoft 64GB (newest model) — 11” paper-like color display — Write in notebooks, docs, and books. Read in any light. Pen included - Graphite
  • Our most advanced Kindle Scribe – Features an 11” Colorsoft display with front light, built-in notebook, AI tools, and support for popular cloud services.
  • Bring ideas to life in color – The custom-built Colorsoft display delivers high-contrast, paper-like color that’s easy on the eyes without distracting flashes when writing.
  • Get a pen-on-paper feel: The textured surface and responsive display create a smooth, paper-like writing experience. Plus, the included pen never needs charging and has a built-in eraser and shortcut button for tools like the highlighter.
  • More room to read, write, and think – Just 5.4mm thin and 400g light, with fluid performance and a large 11" display that gives you space to work comfortably.
  • Get more out of your notes – Take notes in the built-in notebook, then use AI to find information, ask questions about what you’ve written, and generate summaries. You can also clean up handwriting or convert it to text.

The file downloads instead of displaying

Cause: browser preferences, extensions or response handling choose download behavior. Fix: you cannot force identical inline handling across every browser; offer the download as an intentional fallback and test target browser policies.

Characters or fonts are wrong

Cause: the PDF uses jsPDF’s default fonts, which do not cover every writing system. Fix: embed a compatible font in jsPDF and verify the resulting document in the viewers your users rely on.

The preview contains stale data

Cause: application data was read before the latest edit completed. Fix: snapshot the form or fetched data inside the click handler, then generate from that snapshot.

Repeated previews consume memory

Cause: object URLs remain alive while unreleased. Fix: track each URL and revoke it when its preview is closed or after a lifecycle timeout. Do not revoke before the viewer has had time to load.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
Gleeso Tablet, 2026 Latest 10 Inch Android 16 Tablet, 24GB+64GB+1TB TF, 6000mAh Battery, Fast Charging, HD Display, Widevine L1, Dual Camera, Face ID, Split Screen, Light, Portable
  • 【High Performance Android 16 Tablet for Smooth Work & Entertainment】:Looking for a responsive daily electronics computer? This Android 16 tablet is exactly the ideal tablet for adults you need. Powered by upgraded hardware and the newest android 16 system, this 10 inch tablet runs extremely smoothly. It loads apps fast, plays games without lag, and handles multitasking effortlessly. Whether for office work, web browsing or casual entertainment, this steady Android tablet always performs well. It’s a solid and budget-friendly tablet for your daily use.
  • 【24GB+64GB Large Storage & 1TB Expandable Memory Tablet】:Storage issues are totally gone with this 10 inch tablet! Equipped with 24GB RAM and 64GB internal storage, this robust Android tablet can run multiple apps and games simultaneously without slowing down. You can expand the memory up to 1TB with a TF card (not included) to store countless photos, videos and documents. Functional and user-oriented, this tablet for adults is a perfect daily electronics computer for work, study and entertainment.
  • 【6000mAh Long-Lasting Battery & Fast Charging 10 Inch Tablet】:This 10 inch tablet packs a 6000mAh large battery to support your all-day use! It keeps running steadily for video streaming, office work and web browsing, no need to charge frequently. The fast charging feature also saves your precious time, letting you get fully powered up quickly. Lightweight and sturdy, this trust-worthy tablet is a must-have daily electronics computer, and the reliable tablet fits both indoor and outdoor use perfectly.
  • 【10-Inch HD Display & Widevine L1 Certified Android Tablet】:Get a great watching experience on this tablet! The 10-inch 1280*800 HD screen delivers bright and clear visuals for reading, scrolling and video watching. Certified with Widevine L1, this premium tablet supports true full HD streaming on Netflix, Prime Video and other mainstream platforms, no more fuzzy compressed images. As a practical daily electronics computer, this 10 inch tablet brings you crisp, high-quality viewing anytime at home.
  • 【Dual Camera & Stereo Speaker Tablet for Multi-Scenario Use】:Designed for daily adult life, this all-round tablet comes with dual cameras, fast Face ID unlock and dual stereo speakers. The dual cameras support clear video calls and daily photography, and Face ID lets you unlock your device in seconds safely. Matched with immersive stereo sound, this Android tablet greatly upgrades your experience of watching movies, listening to music and chatting online. This versatile android 16 tablet is your perfect portable electronics computer for home, office and travel.
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 actual goal is capturing an existing website rather than constructing a PDF with jsPDF, ScreenshotNeo provides a one-request screenshot API and an MCP server for AI agents. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing result.

cURL:

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

Python:

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:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the parameter reference and additional PDF options in the ScreenshotNeo documentation. An MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.

Practical checklist

  1. Generate the PDF inside a click or other trusted user action.
  2. Use output('bloburl') for a straightforward preview.
  3. Check for null from window.open().
  4. Show a visible link or download fallback.
  5. Keep the Blob URL alive until loading is likely complete, then revoke it.
  6. Test popup, viewer and download behavior in your supported browsers.

Frequently Asked Questions

Can I open a jsPDF file without saving it first?

Yes. Generate a Blob URL with doc.output('bloburl') and open that URL; no intermediate file needs to be written to disk.

Does opening a PDF in a new tab always work on mobile?

No universal guarantee exists. Browser settings, built-in viewers and extensions can change whether a new tab opens or the PDF downloads.

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.

Should I use dataurlnewwindow instead?

It is a documented browser route, but it still depends on popup permission. The Blob URL approach gives you clearer control over fallback handling and URL cleanup.

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.