What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
If a browser slows down or crashes while jsPDF.addImage() builds a PDF, treat it first as a peak-memory problem: reduce image pixels before insertion, avoid keeping several full-resolution canvases and base64 strings alive, and process very large exports in smaller groups. Then verify that the value passed to addImage is a supported type and that its format is correct. These steps address common failure modes, but there is no published universal pixel limit or guaranteed version-only fix.
What the crash usually means
Creating a PDF from images can require several representations of the same data at once: the original image, a decoded bitmap, a canvas backing store, a data URL or byte array, and jsPDF’s internal image data. A page containing many large images can therefore exhaust the browser process even when the source files do not look unusually large on disk.
A large output PDF and a browser crash are different symptoms. A historical jsPDF report describes a canvas image producing an unexpectedly large PDF, but it does not prove that data URLs inherently crash browsers or establish a general conversion ratio. Likewise, a 2025 issue reports rising memory while HTML-to-PDF conversion creates canvas contexts; its proposed canvas reuse and estimated improvements are not independently verified results. See the canvas-context issue and the canvas-image file-size issue for the original reports.
| Symptom | Likely pressure point | First diagnostic |
|---|---|---|
| Memory rises steadily, then the tab dies | Too many decoded pixels, canvases or duplicate representations | Export one image, then increase image count and dimensions separately |
| PDF is much larger than expected but the tab survives | Image encoding or canvas-to-data-URL choices | Compare JPEG, PNG and the actual pixel dimensions |
| Only one particular image fails | Unsupported input, format-detection failure or malformed/hostile dimensions | Log the input type, width, height and explicit format |
| PNG behavior changes between releases | Version-specific rendering behavior | Record the exact jsPDF and browser versions before changing code |
Use an input type that addImage actually accepts
The current jsPDF addImage API documentation lists these input representations:
#1 Best Overall
- 1 ream (500 sheets) of 8.5 x 11 white copier and printer paper for home or office use
- Multipurpose letter size copy paper works with laser/inkjet printers, copiers and fax machines
- Smooth 20lb weight paper for consistent ink and toner distribution; dries quickly and resists paper jams
- Bright white paper (92 GE; 104 Euro) offers great contrast for crisp printing and vivid color
- Virgin copy paper providing professional quality results; acid-free to prevent yellowing
- a base64 data-URL string;
- an
HTMLImageElement; - an
HTMLCanvasElement; - a
Uint8Array; - RGBA data in the documented object shape.
The call supplies a format, x and y coordinates, width and height, followed by optional alias, compression and rotation arguments. If jsPDF cannot recognize the file type, pass the format explicitly. JPEG is documented as the default for canvas elements, but relying on detection is less robust when you already know the source format.
const doc = new jsPDF();
const image = new Image();
image.onload = () => {
// Explicit format avoids guessing when detection is ambiguous.
doc.addImage(image, 'JPEG', 15, 20, 180, 100, undefined, 'MEDIUM', 0);
doc.save('report.pdf');
};
image.onerror = () => console.error('Image could not be decoded');
image.src = '/photo.jpg';
Do not pass an object that merely resembles one of these types. Log Object.prototype.toString.call(value), the source format, and the dimensions immediately before addImage. The repository’s current TypeScript declarations also list the supported representations and compression argument; consult the type declarations when your TypeScript signature and runtime behavior disagree.
Reduce peak memory before calling addImage
Resize to the printed size
Pixels that will be printed at a small size do not need the camera’s full resolution. Calculate the required pixel dimensions from the intended physical size and target resolution, then draw into a smaller canvas before adding it. This reduces decode and canvas memory as well as the amount jsPDF must encode. Keep the original file only if another part of your application still needs it.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →async function resizedJpeg(blob, targetWidth, targetHeight, quality = 0.82) {
const bitmap = await createImageBitmap(blob);
const canvas = document.createElement('canvas');
canvas.width = targetWidth;
canvas.height = targetHeight;
const ctx = canvas.getContext('2d', { alpha: false });
ctx.drawImage(bitmap, 0, 0, targetWidth, targetHeight);
bitmap.close?.();
const dataUrl = canvas.toDataURL('image/jpeg', quality);
canvas.width = 1;
canvas.height = 1;
return dataUrl;
}
async function addPhoto(doc, file) {
const dataUrl = await resizedJpeg(file, 1600, 900);
doc.addImage(dataUrl, 'JPEG', 15, 20, 180, 101.25, undefined, 'MEDIUM');
// Do not retain dataUrl in a long-lived array after this page is complete.
}
The dimensions in this example are illustrative; choose them from the PDF’s physical layout rather than copying them blindly. A JPEG quality setting is a quality/size trade-off, not a fix for invalid input.
Rank #2
- HP Papers is sourced from renewable forest resources and has achieved production with 0% deforestation in North America. Each ream is wrapped in a polyurethane coated paper wrapper to protect the cut sheets from moisture damage
- Sheet size – 8.5 x 11; Thickness – 20 pounds; Brightness – 92 bright white
- HP Copy&Print20 20 pounds printer paper is Forest Stewardship Council (FSC) certified and contributes toward satisfying credit MR1 under LEED (Leadership in Energy and Environmental Design)
- All HP Papers provide premium performance on HP equipment, as well as on all other printer and copier equipment; 100% satisfaction guaranteed; ColorLok technology provides more vivid colors, bolder blacks and faster drying
- Superior quality, reliability, and dependability for high-volume printing at home, at school and in the office; HP Copy&Print20 print and copy paper prevents yellowing over time to ensure a long-lasting appearance for added archival quality
Release temporary references
Do not accumulate every canvas, object URL and data URL in an array while building a long document. Revoke object URLs after an image has loaded, call ImageBitmap.close() where supported, and let temporary canvases become unreachable after use. Clearing a canvas with canvas.width = 1 or assigning a new small canvas can release its backing store sooner, although collection timing remains under the browser’s control.
function loadImage(url) {
return new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => resolve(img);
img.onerror = reject;
img.src = url;
});
}
async function addFromBlob(doc, blob) {
const objectUrl = URL.createObjectURL(blob);
try {
const img = await loadImage(objectUrl);
doc.addImage(img, 'JPEG', 10, 10, 190, 107);
} finally {
URL.revokeObjectURL(objectUrl);
}
}
Releasing a reference does not guarantee an immediate garbage collection, but it prevents your code from retaining objects that the browser could otherwise reclaim.
Avoid duplicate base64 copies
Data URLs are convenient, but converting a binary image to a string can create another large representation. Prefer a directly supported element or byte array when that fits your pipeline. If a data URL is required, create it as late as possible and remove it from caches or component state after addImage finishes.
Free tools Windows power users keep installed
One-click scans. No signup required.
Find whether image size or image count triggers the failure
- Record the exact jsPDF version, browser and operating system, source format, pixel dimensions, number of images, and input representation.
- Generate a PDF with one small image.
- Increase only the pixel dimensions while keeping image count at one.
- Reset the test, then increase only the image count with fixed dimensions.
- Watch the browser’s task manager or development tools for memory growth and note the first failing case.
This procedure is a diagnostic method, not a published browser limit. The available evidence does not establish a universal threshold, a browser/version reproduction matrix, or a guaranteed jsPDF version that fixes every crash.
Rank #3
- 3 ream case (1,500 sheets) of 8.5 x 11 white copier and printer paper for home or office use
- Multipurpose letter size copy paper works with laser/inkjet printers, copiers and fax machines
- Smooth 20lb weight paper for consistent ink and toner distribution; dries quickly and resists paper jams
- Bright white paper (92 GE; 104 Euro) offers great contrast for crisp printing and vivid color
- Virgin copy paper providing professional quality results; acid-free to prevent yellowing
Process image-heavy exports in batches
For galleries, invoices with many photos or HTML pages containing repeated canvases, avoid constructing every intermediate bitmap at once. Build a page or a small group, add the images, and discard temporary objects before continuing. If your rendering architecture creates a canvas for every element, consider reusing a bounded number of canvases and measure peak memory in the browsers you support. The 2025 issue proposing canvas reuse is useful context, but its estimated memory and speed gains are not validated benchmarks.
async function addInBatches(doc, files, batchSize = 4) {
for (let start = 0; start < files.length; start += batchSize) {
const batch = files.slice(start, start + batchSize);
for (const file of batch) {
const dataUrl = await resizedJpeg(file, 1200, 800);
doc.addImage(dataUrl, 'JPEG', 15, 20, 180, 120, undefined, 'MEDIUM');
// Add a page before the next item in a real layout.
// The local dataUrl variable goes out of scope on the next iteration.
}
// Yield to the event loop so the browser can remain responsive.
await new Promise(requestAnimationFrame);
}
}
Batching limits how much your application holds concurrently; it does not guarantee that jsPDF’s complete document can fit in memory. Compare peak memory, output size and image quality in your target browser.
Check format, dimensions and cross-origin loading
Pass the format explicitly
Use 'JPEG', 'PNG' or the format matching the bytes when detection is unreliable. A mismatch can produce decoding errors or corrupted output rather than a memory fix. Keep the format argument next to the call so a later refactor cannot silently change it.
Inspect dimensions before decoding large files
Read image metadata where possible and reject or resize unexpectedly huge inputs before creating a canvas. Do not trust a file extension or a user-supplied width and height. An image with attacker-controlled dimensions deserves the same care as any other untrusted input.
Rank #4
- 5 ream case (2,500 sheets) of 8.5 x 11 white copier and printer paper for home or office use
- Multipurpose letter size copy paper works with laser/inkjet printers, copiers and fax machines
- Smooth 20lb weight paper for consistent ink and toner distribution; dries quickly and resists paper jams
- Bright white paper (92 GE; 104 Euro) offers great contrast for crisp printing and vivid color
- Virgin copy paper providing professional quality results; acid-free to prevent yellowing
Handle cross-origin images correctly
If an image is fetched from another origin, configure the server’s CORS headers and set crossOrigin before assigning src. A canvas made tainted by missing CORS permission cannot be exported with toDataURL; that normally throws a security error rather than causing a browser crash, but it can be misdiagnosed when error handling is absent.
const img = new Image();
img.crossOrigin = 'anonymous';
img.onload = () => {
const canvas = document.createElement('canvas');
canvas.width = 1200;
canvas.height = 800;
canvas.getContext('2d').drawImage(img, 0, 0, 1200, 800);
const jpeg = canvas.toDataURL('image/jpeg', 0.82);
doc.addImage(jpeg, 'JPEG', 15, 20, 180, 120);
};
img.src = 'https://cdn.example.com/photo.jpg';
Security and version checks
If users can upload or supply image URLs, review the current jsPDF security information before choosing a version. The GitLab advisory for CVE-2026-25535 reports that malicious GIF dimensions passed to addImage can trigger out-of-memory errors and denial of service. The surfaced advisory does not establish an affected or fixed version range, so do not infer one; check the advisory’s current details and your dependency’s release information.
An older report documents PNG rendering failure in jsPDF 2.4.0 and 2.5.0. It is evidence of version-specific behavior, not proof that those releases cause the browser crash described here or that one upgrade resolves it; see the PNG rendering report.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11- Validate MIME type and decoded dimensions, not just the filename.
- Set application limits for pixel count and number of images.
- Reject or quarantine malformed files before handing them to a PDF worker.
- Keep dependency versions current according to the advisory and release information.
Move the work off the main thread when appropriate
A Web Worker can keep the interface responsive while you resize and encode images, but it does not remove the memory required by the worker or by the final PDF. Transferable ArrayBuffer objects can avoid some copies; measure rather than assuming. If the complete document is too large for a browser tab, a server-side or streamed PDF architecture may be more suitable. The available reports do not prove that one architecture is best for every workload.
Best Value
- Made in USA: HP Papers is sourced from renewable forest resources and has achieved production with 0% deforestation in North America.
- Optimized for HP technology: All HP Papers provide premium performance on HP equipment, as well as on all other printer and copier equipment.
- Perfect everyday office paper: Superior quality, reliability, and dependability for high-volume printing at home, at school and in the office. Perfect for everyday black and white printing.
- Certified sustainable: HP Office20 20lb printer paper is Forest Stewardship Council (FSC) certified and contributes toward satisfying credit MR1 under LEED (Leadership in Energy and Environmental Design).
- ColorLok technology printing paper: ColorLok technology provides more vivid colors, bolder blacks and faster drying.
Common errors and fixes
| Error or behavior | Cause to investigate | Fix |
|---|---|---|
addImage throws about an unsupported image |
Value is not a supported type or bytes are malformed | Pass an image element, canvas, Uint8Array, data URL or documented RGBA object; validate decoding first |
| Output is huge but export completes | Oversized pixels, lossless PNG or duplicated canvas/data-URL representations | Resize to layout dimensions, choose JPEG where appropriate, and release intermediates |
| Tab becomes slow before crashing | Too many concurrent decoded images or canvas contexts | Test one variable at a time, reduce dimensions and batch work |
toDataURL fails for a remote image |
Tainted canvas from missing CORS permission | Configure server CORS and set crossOrigin before src |
| Only a particular uploaded GIF causes an out-of-memory condition | Malicious or extreme dimensions | Validate dimensions, limit pixels, and review CVE-2026-25535 guidance |
Or skip the browser setup
If your goal is a clean screenshot or PDF of a web page rather than assembling user images inside jsPDF, ScreenshotNeo makes the capture in one request. Its API accepts options for full-page capture, lazy-loaded images, CSS selectors, device and retina settings, PDF paper size and ranges, custom CSS or JavaScript, waits, request blocking, cookies, headers, geolocation, caching and asynchronous jobs. An MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients.
Use the ScreenshotNeo documentation for the complete parameter list. A minimal call is:
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}`);
Before capture, ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets; each step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.
What to record in a bug report
- jsPDF version and installation method;
- browser name, version and operating system;
- image format, decoded width and height, file size and count;
- the exact input representation passed to
addImage; - whether a canvas, data URL, byte array or image element is retained elsewhere;
- the smallest export that reproduces the slowdown, error or crash;
- console errors and whether the failure is a tab crash, browser crash or merely an oversized PDF.
This information separates a reproducible API or security defect from a workload that simply exceeds the available browser memory.
Frequently Asked Questions
Does jsPDF publish a maximum image size for browser use?
No reliable universal pixel threshold or browser-memory limit is established for this crash scenario. Measure the smallest failing dimensions in each supported browser.
Will converting every image to PNG prevent crashes?
No. PNG may preserve quality but can increase output size and memory use. Choose the format and dimensions required by the document.
Should I upgrade jsPDF immediately?
Check current release and security information, especially for untrusted images, but the available evidence does not show a guaranteed version-only fix for this browser crash.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsQuick 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.

