Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchCapture each element with html2canvas(), wait for every returned canvas, and add those canvases to one PDF document in the order and size you want. Use a shared parent instead when the elements must keep their natural document flow. Separate captures give you better control over page breaks, scaling, margins, and ordering, but require explicit PDF layout code.
Choose the capture strategy first
There are three practical ways to turn several DOM regions into one PDF. The right choice depends on whether the regions behave like one flowing document, independent panels, or a complete page that needs automatic page-break handling.
Capture one common container
Put the elements inside a shared container and pass that container to html2canvas(). This is simplest when the visual relationship between sections must remain intact. You make fewer placement decisions because the browser layout is captured as one canvas.
The trade-off is size. A very tall or wide canvas can exceed browser or platform limits and may be blank or partially rendered. Canvas limits vary, so a single giant capture is not a guarantee for long documents.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minute#1 Best Overall
- Scanner type: Document
- Connectivity technology: USB
- With Auto Scan Mode, the scanner automatically detects what you're scanning
- Digitize documents and images
Capture each element separately
Select each region, await its capture, and insert each resulting image into a PDF. This is the most controllable method when every section should start on a new page, when sections have different scaling rules, or when you need to reorder them.
Use an HTML-to-PDF wrapper
A client-side wrapper such as html2pdf.js combines html2canvas with jsPDF and exposes page-break controls. It can be a better fit when your input is one document and you want wrapper-managed flow rather than writing placement logic yourself. Confirm the wrapper’s current option names and supported versions in its official documentation before shipping.
What html2canvas actually captures
html2canvas reconstructs a representation of the DOM from information available to JavaScript. It is not a literal browser screenshot and does not render every CSS property. The html2canvas project describes it as taking “screenshots” of webpages or parts of them directly in the user’s browser, but the result depends on the CSS and browser features it understands.
Its API is asynchronous: html2canvas(element, options) returns a Promise that resolves to a canvas. Do not call pdf.save() until every capture has resolved. The code below uses that sequence explicitly.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Complete example: separate elements, one PDF
This example captures three elements and places each on its own PDF page. It uses browser ES modules and jsPDF. Check the jsPDF release documentation for the exact import and method signatures used by the version you install; the layout sequence is the important part.
<button id="export-pdf">Export PDF</button>
<main>
<section id="cover" class="pdf-section">Cover content</section>
<section id="summary" class="pdf-section">Summary content</section>
<section id="details" class="pdf-section">Details content</section>
</main>
<script type="module">
import html2canvas from "https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/+esm";
import { jsPDF } from "https://cdn.jsdelivr.net/npm/jspdf@2.5.1/+esm";
const button = document.querySelector("#export-pdf");
const ids = ["cover", "summary", "details"];
button.addEventListener("click", async () => {
button.disabled = true;
try {
const pdf = new jsPDF({
orientation: "portrait",
unit: "mm",
format: "a4"
});
const pageWidth = pdf.internal.pageSize.getWidth();
const pageHeight = pdf.internal.pageSize.getHeight();
const margin = 12;
const usableWidth = pageWidth - margin * 2;
const usableHeight = pageHeight - margin * 2;
for (let index = 0; index < ids.length; index += 1) {
const element = document.getElementById(ids[index]);
if (!element) {
throw new Error(`Missing element: ${ids[index]}`);
}
const canvas = await html2canvas(element, {
backgroundColor: "#ffffff",
useCORS: true,
scale: window.devicePixelRatio
});
const image = canvas.toDataURL("image/png");
const imageRatio = canvas.width / canvas.height;
let imageWidth = usableWidth;
let imageHeight = imageWidth / imageRatio;
if (imageHeight > usableHeight) {
imageHeight = usableHeight;
imageWidth = imageHeight * imageRatio;
}
const x = (pageWidth - imageWidth) / 2;
const y = margin;
if (index > 0) {
pdf.addPage();
}
pdf.addImage(image, "PNG", x, y, imageWidth, imageHeight);
}
pdf.save("combined-elements.pdf");
} catch (error) {
console.error("PDF export failed", error);
alert("The PDF could not be created. Check the console for details.");
} finally {
button.disabled = false;
}
});
</script>
The loop preserves the ids order. Each canvas is converted to a data URL, scaled to fit inside the A4 page’s usable rectangle, and added after the first page. If a section is wider or taller than the page ratio, the code scales it down without stretching.
Put several canvases on one page
You do not have to dedicate a page to every element. Calculate a grid or stack positions and call addImage() repeatedly before adding the next page.
Rank #2
- 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
const gutter = 6;
const columnWidth = (usableWidth - gutter) / 2;
const first = await html2canvas(document.querySelector("#left"), {
backgroundColor: "#fff",
useCORS: true
});
const second = await html2canvas(document.querySelector("#right"), {
backgroundColor: "#fff",
useCORS: true
});
const firstHeight = columnWidth * first.height / first.width;
const secondHeight = columnWidth * second.height / second.width;
const rowHeight = Math.max(firstHeight, secondHeight);
pdf.addImage(first.toDataURL("image/png"), "PNG", margin, margin,
columnWidth, firstHeight);
pdf.addImage(second.toDataURL("image/png"), "PNG",
margin + columnWidth + gutter, margin, columnWidth, secondHeight);
if (rowHeight + margin * 2 > pageHeight) {
// Choose a smaller width, split the row, or put the elements on separate pages.
}
For content whose height is not known until capture time, measure the resulting canvas before choosing the next y-coordinate. If the next image would cross the bottom margin, call pdf.addPage() and reset the y-coordinate.
Capture a shared container instead
When sections should flow exactly as laid out in the page, capture their parent:
const container = document.querySelector("#invoice");
const canvas = await html2canvas(container, {
backgroundColor: "#ffffff",
windowWidth: container.scrollWidth,
windowHeight: container.scrollHeight,
useCORS: true
});
const image = canvas.toDataURL("image/png");
pdf.addImage(image, "PNG", margin, margin, usableWidth,
usableWidth * canvas.height / canvas.width);
Matching windowWidth and windowHeight to the element’s scroll dimensions can help when the visible viewport is smaller than the content. It does not remove browser canvas limits; a very large result may still fail or be clipped.
Images, iframes, and cross-origin security
Cross-origin images
An image loaded from another origin can taint the canvas. useCORS: true only helps when that image server sends an appropriate Access-Control-Allow-Origin header. It cannot bypass CORS policy. If you control the asset server, configure CORS there. Otherwise, serve the asset through a same-origin proxy that you operate and that is allowed to retrieve it.
Test every remote logo, chart, font-backed image, and CSS background used by the target element. A single disallowed resource can make toDataURL() throw a security error or leave the output incomplete.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Cross-origin iframes
Browser security prevents html2canvas from reading the document inside a cross-origin iframe. Same-origin iframe content can be rendered recursively, subject to the content’s own assets and CSS. If the embedded page is on another origin, capture it from that origin or use a server-side screenshot service instead.
Exclude controls and transient UI
Add data-html2canvas-ignore to elements that should not appear, such as export buttons, loading indicators, or interactive controls:
Rank #3
- 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
- INNOVATION YOU CAN TRUST. Cartridge-free printing that keeps you printing longer with fewer interruptions, powered by the trusted HP innovation you rely on today
- PREMIUM SUPPORT - Strong technical expertise to solve issues faster.
<button data-html2canvas-ignore>Export</button>
You can also supply an ignore predicate in the configuration for dynamic rules. Hiding an element with CSS before capture is another option, but restore the UI in a finally block so a failed export does not leave the page altered.
Page breaks, long sections, and readable output
- Separate-page policy: capture each section independently and add a page before every section after the first.
- Flow policy: capture a common parent or use an HTML-to-PDF wrapper with documented page-break controls.
- Oversized section: split the section into smaller DOM regions, reduce capture scale, or place the image across multiple PDF pages. Do not assume one huge canvas will work on every browser.
- Sharpness: a higher
scaleincreases pixel density and file size.window.devicePixelRatiooften improves text appearance, but it also increases memory use. - Selectable text: the canvas workflow inserts raster images into the PDF. Do not promise searchable or selectable text unless your chosen PDF implementation separately creates a text layer.
Performance and reliability practices
Capture only what is needed
Limit the target element’s dimensions, hide expensive animations, and remove video or rapidly changing widgets before capture. Capturing three focused sections usually uses less memory than rendering an entire application shell.
Recommended Free Tools
Wait for content to settle
Wait for data rendering and image loading before calling html2canvas. For images you create dynamically, await their load events. Freeze animations or add a temporary class that sets animation: none and transition: none.
Handle repeated exports
Long-lived applications can retain image-cache state between captures. The configuration documents a clearImageCache option for releasing that state. Avoid enabling it when concurrent captures depend on a shared cache; serialize exports or manage concurrency deliberately.
Keep the UI responsive
Large captures are CPU- and memory-intensive. Disable the export button while work is running, show progress for many sections, and catch errors around both the html2canvas call and PDF insertion. Never leave a rejected Promise unhandled.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshooting checklist
The PDF is blank
- Confirm the selector returns an element and that it has non-zero dimensions.
- Wait until fonts, images, and application data have loaded.
- Reduce the capture dimensions or split a very tall region.
- Inspect the browser console for a canvas-security exception.
The bottom or right side is cut off
- Capture the correct scrolling container rather than only the viewport.
- Set
windowWidthandwindowHeightto the target’s scroll dimensions when appropriate. - Check the resulting canvas dimensions before placing it in the PDF.
Images are missing or cause a security error
- Use
useCORS: trueonly when the remote server sends a compatible CORS header. - Move assets to the same origin or use an authorized same-origin proxy.
- Remember that cross-origin iframe documents cannot be read by the browser.
The PDF pages are out of order
Build an explicit array in the required order and await captures sequentially, as in the first example. If you capture concurrently with Promise.all(), still insert the resolved canvases using the original array order.
The output looks stretched
Preserve the ratio canvas.width / canvas.height. Fit by width, then reduce both dimensions when the calculated height exceeds the page’s usable height.
Rank #4
- 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)
Styles differ from the page
html2canvas supports only the CSS it understands. Unsupported effects, browser-only rendering, pseudo-elements, filters, and complex layout features may differ. Simplify the export stylesheet and compare the result in each browser you support.
Or skip the browser setup
ScreenshotNeo provides a website screenshot API when you need a rendered page rather than a client-side canvas assembly. A single request can return PNG, JPEG, WebP, or PDF. It accepts cookie and 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 report the page verdict and whether the request was billed. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.
For a PDF of a URL, use the API documented at ScreenshotNeo’s documentation:
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 →Repair Windows errors before they cause bigger problemsFix Now →curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://stripe.com
-o shot.webp
In Python:
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
In 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}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const body = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', body));
ScreenshotNeo’s Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots, and every feature is on every plan. Create a free ScreenshotNeo account to try it.
FAQ
Can I combine canvases created at different times?
Yes. A PDF document can receive images from separate capture calls as long as you retain each canvas until it has been inserted and maintain the intended order.
Will this method preserve live hyperlinks?
No. The captured canvas is an image. Adding working PDF links requires separate link annotations or a PDF workflow that creates links independently.
Is html2canvas suitable for Node.js rendering?
No. It relies on browser APIs and is intended for modern evergreen browsers, not server-side Node.js rendering.
Free tools Windows power users keep installed
One-click scans. No signup required.
Should I use PNG or JPEG in the PDF?
PNG is usually preferable for text, line art, and transparent graphics. JPEG can reduce size for photographic content but introduces lossy compression. Choose based on the visual content and acceptable file size.
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.

