PC 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 & 11Crashes, 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 minuteThe white area is usually created before jsPDF places your image. When html2canvas paints an opaque element, canvas.toDataURL() preserves those white pixels, so changing addImage() coordinates cannot make a background image show through. Render with transparency where appropriate, remove opaque CSS backgrounds and pseudo-elements, then place the PNG inside a calculated margin rectangle.
Why a transparent image becomes white
There are two separate operations in this workflow:
- Rendering:
html2canvasconverts HTML and CSS into a bitmap. A white element background, pseudo-element, or browser-rendered fallback can become real pixels at this stage. - Placement: jsPDF’s
addImage()puts that bitmap on a PDF page at the supplied coordinates and dimensions.
If the canvas already contains white pixels, moving the image inward to create margins only moves the white pixels. This is the behavior described in jsPDF issue #3716, where containers rendered by html() had white backgrounds and hid a background image added with doc.addImage().
What transparency can and cannot fix
backgroundColor: null asks html2canvas to keep the canvas background transparent. It does not override CSS such as background: #fff, a white pseudo-element, an inline style, or an image that itself contains white pixels. Issue #3677 demonstrates the option as a practical configuration, not a guarantee for every page or browser.
Recommended Free Tools
#1 Best Overall
- PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
- QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
- VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
- INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
- EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0
Minimal transparent capture with margins
Use this browser-side pattern when the source is an HTML element and you want an image-based PDF. The canvas is rendered without an automatic background, then scaled proportionally to the available width.
import html2canvas from "html2canvas";
import jsPDF from "jspdf";
const element = document.querySelector("#invoice");
html2canvas(element, {
backgroundColor: null
}).then((canvas) => {
const pdf = new jsPDF({
orientation: "p",
unit: "mm",
format: "a4"
});
const marginX = 12;
const marginTop = 15;
const marginBottom = 15;
const pageWidth = pdf.internal.pageSize.getWidth();
const pageHeight = pdf.internal.pageSize.getHeight();
const contentWidth = pageWidth - marginX * 2;
const imageHeight = canvas.height * contentWidth / canvas.width;
const png = canvas.toDataURL("image/png");
pdf.addImage(
png,
"PNG",
marginX,
marginTop,
contentWidth,
imageHeight,
"page-image-1"
);
let remaining = imageHeight - (pageHeight - marginTop - marginBottom);
let consumed = pageHeight - marginTop - marginBottom;
let pageNumber = 2;
while (remaining > 0) {
pdf.addPage();
const y = marginTop - consumed;
pdf.addImage(
png,
"PNG",
marginX,
y,
contentWidth,
imageHeight,
`page-image-${pageNumber}`
);
consumed += pageHeight - marginTop - marginBottom;
remaining -= pageHeight - marginTop - marginBottom;
pageNumber += 1;
}
pdf.save("output.pdf");
});
The first image starts at (marginX, marginTop). Its width is the page width minus both horizontal margins, and its height is calculated from the canvas aspect ratio. The pagination counter subtracts only the usable content height, preserving top and bottom offsets on each page.
How jsPDF coordinates and image arguments work
The API signature is addImage(imageData, format, x, y, width, height, alias, compression, rotation). The input can be a base64 data URL, an HTMLImageElement, an HTMLCanvasElement, a Uint8Array, or RGBA data. PNG, JPEG and WEBP are documented formats.
xis measured from the page’s left edge.yis measured from the page’s upper edge.widthandheightuse the unit selected when creating the document, such as millimetres.aliasidentifies a reusable image resource. Give distinct images distinct aliases when diagnosing replacement problems.
For a page width of pageWidth and horizontal margin marginX, use contentWidth = pageWidth - 2 * marginX. Do not hard-code an image height unless distortion is acceptable.
Rank #2
- FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
- ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
- READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
- WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
- OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)
Keeping margins on every page
The oversized-image method
The sample above adds one tall image repeatedly with a negative vertical offset. It is compact and follows the pattern shown in issue #3677. The PDF viewer clips the portion outside the page. This is suitable when a rasterized page can cross a page boundary and exact selectable text is not required.
Per-page slices for exact clipping
For invoices, reports or screenshots where a boundary must occur at an exact pixel row, create a separate canvas slice for each page (or draw only the visible source rectangle onto a page-sized canvas) and call addImage() once per slice. This avoids relying on viewer clipping and lets you insert deliberate gaps between sections. It also prevents text from being split unpredictably, although the text remains rasterized.
Raster output versus selectable PDF text
| Approach | Transparency | Pagination | Text quality |
|---|---|---|---|
| html2canvas plus one oversized PNG | Depends on canvas alpha and CSS | Fast offset loop | Rasterized, not selectable |
| html2canvas plus per-page slices | Depends on canvas alpha and CSS | Explicit clipping and breaks | Rasterized, not selectable |
| Native jsPDF text and vector drawing | Controlled by drawing operations | Explicit layout | Selectable and searchable |
Finding and removing the white pixels
- Inspect the element passed to html2canvas in browser developer tools.
- Check
backgroundandbackground-coloron the element and every container around it. - Inspect
::beforeand::afterpseudo-elements; a full-size white pseudo-element can cover a background image. - Remove temporary white styles or override them for the capture, for example
element.style.backgroundColor = "transparent". - Render with
backgroundColor: null, export as PNG, and inspect the PNG against a checkerboard image viewer. - Remember that a white JPEG is opaque by definition; use a PNG with an alpha channel when transparency is required.
If you use jsPDF’s html() method directly, the same principle applies: inspect the rendered DOM and its computed styles. Issue #3716 indicates that changing only the final addImage() call does not undo opaque container backgrounds introduced during HTML rendering.
Multiple images and aliases
When adding several PNGs, create each data URL from the intended source and keep aliases unique. Issue #3603 reports one PNG replacing another in a multi-image workflow and discusses aliases. A safe pattern is:
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Rank #3
- FAST DOCUMENT SCANNING — Document scanner with feeder allows you to speed through stacks with a 50-sheet Auto Document Feeder (ADF); Efficient office scanner to help you scan more productively
- INTUITIVE, HIGH-SPEED SOFTWARE — Quickly scan with this desktop document scanner; Epson ScanSmart Software lets you easily preview scans, email files, upload to the cloud, and more; Plus, automatic file naming saves even more time
- SEAMLESS INTEGRATION — Easily incorporate your data into most document management software with the included TWAIN driver; Office document scanner integrates seamlessly with business workflows
- EASY SHARING — Duplex scanner allows you to scan straight to email or popular cloud storage2 services like Dropbox, Evernote, Google Drive, and OneDrive for simple storage and sharing
- SIMPLE FILE MANAGEMENT — Scanner allows the creation of searchable PDFs with Optical Character Recognition (OCR) and convert scans to editable Word or Excel files effortlessly; Designed for home and office document scanning
pdf.addImage(firstPng, "PNG", 12, 15, 80, 40, "logo-image");
pdf.addImage(secondPng, "PNG", 12, 60, 80, 40, "chart-image");
Do not reuse an alias for unrelated image bytes. If the same image is intentionally reused on many pages, reusing its alias can reduce resource duplication; verify the result in the PDF viewers your users support.
Common failures and fixes
White rectangle still covers the background
Cause: CSS or a pseudo-element painted white before export. Fix: remove or override that style and use backgroundColor: null. Confirm the generated PNG itself has alpha; jsPDF cannot restore transparency that is absent from the PNG.
Top margin appears only on the first page
Cause: the loop subtracts the full page height, or the next page starts at 0. Fix: subtract pageHeight - marginTop - marginBottom and calculate each subsequent y from the consumed content height.
Content is stretched
Cause: width and height were chosen independently. Fix: calculate imageHeight = canvas.height * contentWidth / canvas.width.
Rank #4
- Scanner type: Document
- Connectivity technology: USB
- With Auto Scan Mode, the scanner automatically detects what you're scanning
- Digitize documents and images
Images overwrite one another
Cause: duplicate aliases or incorrect image data. Fix: use unique aliases, verify each toDataURL("image/png") result, and add images at distinct coordinates.
External images are missing from the canvas
Cause: browser cross-origin restrictions or resources that were not available when html2canvas ran. Fix: serve images with appropriate cross-origin headers, ensure they load before capture, and test the rendered canvas independently of jsPDF. The supplied issue examples do not establish a universal cross-origin setting, so validate against your deployment.
Large pages run out of memory
Cause: a full-page canvas can contain millions of pixels, and the same bitmap may be embedded repeatedly. Fix: capture at the smallest useful scale, slice very tall content, avoid unnecessary duplicate images, and release temporary canvases after saving.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server. It accepts a URL and returns PNG, JPEG, WebP or PDF. Cookie and consent banners, newsletter popups and chat widgets are removed 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. Its MCP server provides take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsOne-call cURL example (see the ScreenshotNeo API documentation):
Best Value
- OUR MOST ADVANCED SCANSNAP. Large touchscreen, fast 45ppm double-sided scanning, 100-sheet document feeder, Wi-Fi and USB connectivity, automatic optimizations, and support for cloud services. Upgraded replacement for the discontinued iX1600
- CUSTOMIZABLE. SHARABLE. Select personalized profiles from the touchscreen. Send to PC, Mac, mobile devices, and clouds. QUICK MENU lets you quickly scan-drag-drop to your favorite computer apps
- STABLE WIRELESS OR USB CONNECTION. Built-in Wi-Fi 6 for the fastest and most secure scanning. Connect to smart devices or cloud services without a computer. USB-C connection also available
- PHOTO AND DOCUMENT ORGANIZATION MADE EFFORTLESS. Easily manage, edit, and use scanned data from documents, receipts, photos, and business cards. Automatically optimize, name, and sort files
- AVOIDS PAPER JAMS AND DAMAGE. Features a brake roller system to feed paper smoothly, a multi-feed sensor that detects pages stuck together, and skew detection to prevent paper damage and data loss
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}`);
It also supports full-page captures, element selectors, custom CSS and JavaScript, waits, request blocking, cookies, headers, device presets, retina scale, PDF page settings, caching, signed links, asynchronous jobs and bulk capture. 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.
Production checklist
- Confirm the source element and its pseudo-elements have no unintended opaque backgrounds.
- Use
backgroundColor: nulland PNG when alpha is needed. - Calculate content width from the PDF page size and margins.
- Preserve aspect ratio when deriving image height.
- Choose oversized placement or explicit slices based on clipping and text requirements.
- Use unique aliases for unrelated images.
- Test transparent output, page breaks and image loading in the PDF viewers used by your audience.
- Recheck behavior when upgrading jsPDF or html2canvas; issue reports are examples, not version-independent guarantees.
Frequently Asked Questions
Can jsPDF make a white PNG transparent?
No. jsPDF places the image data it receives; remove the white pixels during HTML/CSS rendering or preprocess the image before calling addImage().
Which format should I use for transparent screenshots?
Use PNG. JPEG does not carry an alpha channel, while PNG can preserve transparency when the canvas and source styles actually contain it.
Will this method keep HTML text selectable?
No. html2canvas produces a raster image. Build text with jsPDF drawing and text APIs, or use a different document-generation approach, when selection and search are requirements.
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.

