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

html2canvas will not automatically copy the moving picture shown by a <video> element. Capture the required frame yourself with the Canvas API, wait until the video has decoded it (and, when seeking, until seeked fires), then pass the resulting image to jsPDF’s addImage(). You can either place that image in the DOM before html2canvas renders the page or insert it directly into the PDF.

Why the video is blank

html2canvas reconstructs a rendering from DOM and style information; it is not a native screenshot of the browser’s compositor. The project documentation warns that the result can differ from the pixels visibly painted by the browser. A video’s current decoded frame therefore needs to be converted into ordinary canvas pixels before export.

The Canvas 2D API accepts an HTMLVideoElement as a drawImage() source. The canvas must be readable under the same-origin policy, and the video must have usable frame data. Playing successfully on screen does not by itself guarantee that a canvas export will be allowed.

Choose the frame to export

Capture the current playback position

Wait until video.readyState > 1 (the video has data for the current position), then draw it. If the player is still buffering, wait for a readiness event such as loadeddata or canplay.

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.
#1 Best Overall
Epson EcoTank ET-2800 Wireless Color All-in-One Supertank Printer - Black
  • INNOVATIVE CARTRIDGE-FREE PRINTING — No more dealing with lots of tiny ink cartridges; With this wireless document and photo printer each ink bottle set is equivalent to about 90 individual cartridges²
  • LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; When you choose this combination printer, scanner and copier you can print up to 4,500 pages black/7,500 color³
  • COLOR PRINTING — Up to 2 years of ink in the box4 (and with every replacement ink set) for fewer out-of-ink frustrations
  • ZERO CARTRIDGE WASTE — By using an Epson EcoTank printer you can help reduce the amount of cartridge waste ending up in landfills
  • HOME PRINTER DESIGNED FOR RELIABILITY — The Epson EcoTank ET-2800 All-in-One Supertank Color Printer creates vivid, detailed prints and documents thanks to Micro Piezo Heat-Free Technology; Fire off 10 ISO pages per minute1 to easily finish large jobs

Capture a specific timestamp

Assign video.currentTime, then wait for the seeked event before drawing. Seeking is asynchronous; drawing immediately after setting the property can reproduce the previous frame or an empty canvas.

Synchronize with a presented compositor frame

Where available, requestVideoFrameCallback() schedules work when a new video frame is presented. MDN marks this API Baseline 2024 (available across current browsers since October 2024), but older browsers and devices may not implement it, so retain an event-based fallback.

Complete browser example: frame in the DOM, then html2canvas and jsPDF

This example seeks to 12 seconds, creates a canvas at the video’s decoded dimensions, replaces an image placeholder in the printable section, and renders that section with html2canvas. It assumes the libraries are already loaded in the page.

async function waitForSeek(video, time) {
  if (video.readyState < 2) {
    await new Promise(resolve => video.addEventListener('loadeddata', resolve, { once: true }));
  }
  if (Math.abs(video.currentTime - time) > 0.01) {
    await new Promise((resolve, reject) => {
      const onSeeked = () => { cleanup(); resolve(); };
      const onError = () => { cleanup(); reject(new Error('Video seek failed')); };
      const cleanup = () => {
        video.removeEventListener('seeked', onSeeked);
        video.removeEventListener('error', onError);
      };
      video.addEventListener('seeked', onSeeked, { once: true });
      video.addEventListener('error', onError, { once: true });
      video.currentTime = time;
    });
  }
}

function frameCanvas(video) {
  if (!video.videoWidth || !video.videoHeight || video.readyState <= 1) {
    throw new Error('Video has no decoded frame yet');
  }
  const canvas = document.createElement('canvas');
  canvas.width = video.videoWidth;
  canvas.height = video.videoHeight;
  canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
  return canvas;
}

async function exportPdf() {
  const video = document.querySelector('#sourceVideo');
  await waitForSeek(video, 12);

  const still = frameCanvas(video);
  const image = document.querySelector('#videoStill');
  image.src = still.toDataURL('image/jpeg', 0.92);
  image.width = still.width;
  image.height = still.height;

  const page = document.querySelector('#printArea');
  const rendered = await html2canvas(page, {
    backgroundColor: '#ffffff',
    scale: window.devicePixelRatio || 1
  });

  const { jsPDF } = window.jspdf;
  const pdf = new jsPDF({ orientation: 'landscape', unit: 'mm', format: 'a4' });
  const margin = 10;
  const pageWidth = 297 - margin * 2;
  const pageHeight = pageWidth * rendered.height / rendered.width;
  pdf.addImage(rendered.toDataURL('image/png'), 'PNG', margin, margin, pageWidth, pageHeight);
  pdf.save('video-frame.pdf');
}

Use markup like this:

<video id="sourceVideo" controls crossorigin="anonymous" src="/media/demo.mp4"></video>
<section id="printArea">
  <h1>Playback report</h1>
  <img id="videoStill" alt="Selected video frame">
</section>
<button type="button" onclick="exportPdf()">Export PDF</button>

The intrinsic canvas size uses video.videoWidth and video.videoHeight, preserving the source aspect ratio. The PDF image is scaled to fit the selected A4 landscape geometry; adjust the margin and orientation for your document.

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.
Rank #2
Sale
Epson EcoTank Photo ET-8550 Wireless Wide-Format All-in-One Tank Printer
  • CARTRIDGE-FREE PRINTING — Print lab-quality photos, graphics and creative projects; Get vibrant colors and sharp text with Epson's high-accuracy printhead and Claria ET Premium 6-color inks
  • INK BOTTLES — Save on photos1 and creative projects with affordable in-house printing; All-in-one printer allows you to print 4" x 6" photos for about 4 cents each vs. 40 cents with traditional ink cartridges1
  • LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; Printer, scanner and copier lets you print up to 6,200 color pages³
  • PRINT FOR LONGER — Up to 2 years of ink in the box² (and with every replacement ink set) for fewer out-of-ink frustrations with this wireless printer
  • ZERO CARTRIDGE WASTE — Epson EcoTank printer helps reduce the amount of cartridge waste ending up in landfills; Cartridge-free printer uses high-yield ink bottles; Each replacement ink bottle set is equivalent to about 100 individual ink cartridges⁴

Insert the frame directly with jsPDF

If the surrounding page does not need html2canvas, skip DOM rendering for the still. Convert the prepared canvas to a data URL and place it with PDF coordinates:

const stillUrl = still.toDataURL('image/jpeg', 0.92);
const { jsPDF } = window.jspdf;
const pdf = new jsPDF({ unit: 'mm', format: 'letter' });
const x = 15, y = 20, width = 180;
const height = width * still.height / still.width;
pdf.addImage(stillUrl, 'JPEG', x, y, width, height);
pdf.save('still-only.pdf');

This approach gives direct control over placement and avoids rendering unrelated DOM. The DOM-placeholder approach keeps the frame aligned with headings, captions and other content; choose based on your layout.

Using requestVideoFrameCallback safely

For a frame that corresponds to the next compositor presentation, use the callback when implemented:

function nextPresentedFrame(video) {
  return new Promise(resolve => {
    if ('requestVideoFrameCallback' in video) {
      video.requestVideoFrameCallback(() => resolve());
    } else {
      requestAnimationFrame(() => resolve());
    }
  });
}

await waitForSeek(video, 12);
await nextPresentedFrame(video);
const still = frameCanvas(video);

This is useful when exact presentation timing matters. It is not a replacement for waiting for seeked after a seek.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
HP Smart Tank 5000 Wireless All-in-One Ink Tank Printer, Scanner, Copier with 2 Years of Ink Included, Best-for-Home, Cartridge-Free, Refillable and AI-Enabled. (5D1B6A)
  • SET IT UP ONCE AND PRINT WITH CONFIDENCE. No complicated maintenance. Just easy, reliable printing you can count on.
  • INK FOR YEARS. NOT MONTHS. Up to 2 years of ink included. Get thousands of pages of cartridge-free printing. More pages, less hassle
  • KEEPS PRINTING WELL AFTER COMPETITORS HAVE QUIT. No complex maintenance. Sharper text, richer colors.[2] Only with HP Smart Tank
  • PREMIUM SUPPORT - Strong technical expertise to solve issues faster
  • THE LAST PRINTER YOU'LL EVER NEED. Enjoy years of refillable, cartridge-free printing.

Cross-origin and security requirements

Video served from another origin

A cross-origin resource can taint the canvas. Set crossorigin="anonymous" before loading the source and configure the media server to return a compatible Access-Control-Allow-Origin header. The header must come from the server that serves the video; a client-side option cannot manufacture it.

Cross-origin iframes

html2canvas cannot inspect the document inside a cross-origin iframe. If the player is embedded from another site, capture a frame in the iframe’s own origin (with that site’s cooperation) or use an allowed media URL instead of trying to read the iframe DOM.

Previously tainted canvases

Once foreign pixels have been drawn without permission, calls such as toDataURL() can throw a security error. Create a fresh canvas after correcting CORS; a tainted canvas cannot be “untainted” by later code.

Canvas size, quality and PDF limits

  • Very large full-page renders can exceed browser canvas limits and become blank or partial. Rough evergreen guidance cited by the html2canvas FAQ is about 32,767 pixels per dimension on Chrome/Chromium, Firefox and desktop Safari, with approximate maximum areas of 268 megapixels for Chrome/Chromium and 472 megapixels for Firefox. These are platform-, GPU-, RAM- and version-dependent, not guarantees; iOS Safari is generally lower.
  • Keep the video canvas at decoded dimensions, then scale for the PDF. Enlarging a small source cannot restore detail.
  • Use JPEG for photographic video frames when a smaller file is preferable; use PNG when text overlays or transparency require lossless output. Match the format argument in addImage() to the data URL.
  • For long pages, render sections separately and add PDF pages rather than creating one enormous canvas.

Common failures and fixes

Symptom Likely cause Fix
Video area is blank in the PDF No decoded frame was drawn; html2canvas cannot capture moving video directly. Wait for readiness, draw with drawImage(), and use the resulting image or canvas.
Wrong frame after seeking Drawing occurred before the seek completed. Await the seeked event, then optionally await requestVideoFrameCallback().
SecurityError from toDataURL() Cross-origin media tainted the canvas. Configure CORS, set crossorigin before loading, use same-origin media, or process the frame in an authorized server context.
html2canvas omits an embedded player The player is inside a cross-origin iframe. Capture an accessible media URL or obtain cooperation from the iframe origin; the parent page cannot read its document.
Export is blank or truncated Canvas dimensions exceed a browser or device limit. Lower html2canvas scale, split content across pages, reduce video resolution, and test on the target browser.
Works locally but not in production Production headers, URL scheme or media permissions differ. Inspect response headers, ensure HTTPS and CORS are correct, and test with the deployed media URL.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Client-side versus server-side generation

html2canvas depends on browser APIs and is client-side. It is not a server-side PDF renderer. For automated server jobs, the html2canvas FAQ points to headless browser drivers such as Puppeteer or Playwright; those can load the page, wait for media readiness, draw or capture the frame, and then create the PDF in a controlled browser environment. Cross-origin policy and authentication still apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
NDYIN Portable Printers Wireless for Travel, N80 Bluetooth Thermal Printer
  • Wireless Bluetooth Printer: Portable thermal printer compatible with iPhone, Android phones, iPad and tablet computers via Bluetooth. For smartphones, please download the "Nada Print" App. You can also connect to laptops and computers for printing using a USB-C cable. (Note: Laptops and computers can only be connected via USB and require the installation of a driver first. Bluetooth connection is not supported.)
  • No-ink printing: Only supports US Letter and A4 size thermal paper.(Doesn't support regular paper) The no-ink portable thermal printer uses direct thermal technology, requiring no ink, toner or ribbons, making it environmentally friendly, cost-effective and time-saving. The thermal printer package comes with a roll of US Letter thermal printing paper. Note: When installing the paper, remember to switch the paper size switch on APP
  • Clear Print: NDYIN N80 portable thermal printer adopts high-definition printing technology, with a 203DPI resolution to provide you with clear printing results. This mobile printer is compatible with roll paper, folded paper and tattoo transfer paper, supporting printing from your mobile phone PDF, Word, pictures and web pages anytime and anywhere. It is recommended to use our NDYIN thermal paper to achieve good printing quality
  • Portable wireless printer for travel: The thermal printer is equipped with a built-in 1500mAh rechargeable battery, which can print 160 sheets of 8.5" x 11" thermal paper after being fully charged. It weighs only 1.5 pounds and is compact in size. This ink-free portable printer can be easily carried in a backpack or briefcase! It is perfect for business travel, cars, small offices, construction sites, schools and homes. You can print documents, contracts, invoices and boarding passes anytime and anywhere
  • The N80 thermal printer has a wide range of uses. The package includes the N80 printer, a roll of US Letter paper(7m/roll), a user manual, a guide card, a type-C soft cable and a type C adapter. Note: The charging adapter is not included. Special thermal paper is required for use; ordinary paper cannot be used. This ink-free portable thermal printer is suitable for various scenarios such as home, school, travel, office, and outdoor, meeting the printing needs of different groups of people. This tattoo template printer is also compatible with tattoo transfer paper, making it an ideal choice for tattoo art

Or skip the browser setup

ScreenshotNeo provides a website screenshot API and MCP server. A single request returns PNG, JPEG, WebP or PDF, while its capture flow accepts consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets before the shot. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status.

For a URL-based capture, see the ScreenshotNeo API documentation:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
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)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients. Every feature is on every plan: 1,000 shots monthly free with no card, then Starter $5 for 3,000; yearly billing provides two months free. Create a free ScreenshotNeo account.

Frequently Asked Questions

Can html2canvas capture a playing video without extra code?

No. Draw the desired frame from the HTMLVideoElement onto a canvas first, then render that canvas or its image.

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

Should I pause the video before drawing?

Pausing is optional. For a deterministic timestamp, seek and await seeked; for presentation timing, use requestVideoFrameCallback when available.

Why does useCORS sometimes fail?

It only works when the remote server sends suitable Access-Control-Allow-Origin headers. The browser cannot override a server’s missing CORS permission.

Is requestVideoFrameCallback available everywhere?

It is Baseline 2024 for current browsers, but older browsers may lack it; provide an event or animation-frame fallback.

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.

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