Squished images have a simple cause: width and height were changed by different proportions somewhere between the source image, the html2canvas bitmap, and jsPDF placement. Check each stage, then derive one output dimension from the other. If the source is sourceWidth × sourceHeight and the PDF width is pdfWidth, use pdfHeight = pdfWidth * sourceHeight / sourceWidth.
Find the stage that changes the aspect ratio
There are two separate failure branches. The image may already be distorted in the canvas produced by html2canvas, or the canvas may be correct while jsPDF stretches it when placing it in the PDF. A third class of problem—blank, missing, or clipped images—is usually caused by cross-origin restrictions or canvas limits, not by aspect ratio.
- Inspect the source image’s intrinsic dimensions. For an
<img>, logimg.naturalWidthandimg.naturalHeight. - Inspect the captured canvas with
canvas.widthandcanvas.height. View the canvas itself before converting it to a PDF. - If the canvas is distorted, investigate the DOM dimensions, CSS, viewport settings, and html2canvas options.
- If the canvas looks correct, inspect the dimensions passed to
doc.addImage()or the scaling options used bydoc.html().
Measure the ratios
Calculate naturalWidth / naturalHeight, canvas.width / canvas.height, and the final PDF placement ratio. The first ratio that differs materially from the intended ratio identifies where to fix the code.
const img = document.querySelector('#photo');
console.log({
source: [img.naturalWidth, img.naturalHeight],
sourceRatio: img.naturalWidth / img.naturalHeight
});
const canvas = await html2canvas(document.querySelector('#capture'));
console.log({
bitmap: [canvas.width, canvas.height],
bitmapRatio: canvas.width / canvas.height
});
Fix distortion when placing a canvas with addImage()
addImage() accepts an independent width and height. If those values imply a different ratio from the source, jsPDF will stretch the bitmap. A reported issue involving fixed dimensions of 65 × 60 mm illustrates the symptom; it does not mean every call with those values is wrong.
#1 Best Overall
- User-Friendly Portable Photo Printer for iPhone, Android & PC - Get beautiful and colourful memories with Liene 4x6 photo printer! After opening the entire package, you can find one cartridge + 20 sheets of photo paper (placed inside the machine packaging), as well as an additional box containing 80 sheets of photo paper (which includes two cartridges + 80 sheets of photo paper). Full package includes smartphone photo printer, Liene 4x6 photo printer papers (100 sheets), 3 colour cartridges, and fully sealed cassette to prevent dust. Minimalist and magnetic design for compact storage.
- Superior Quality 4x6 Photo Printer - Print photos like no other thanks to the thermal-dye sublimation tech adopted by the picture printer for iphone. The dyes deeply penetrate the paper for vibrant photo printing, and the laminated surface is resistant to water, scratches, fingerprints and fading. Clean the print head promptly if smudges are observed on printed photos during operation. Get Liene photo printers now for yourself and your loved ones, print your happy moments together and keep your love forever!
- Wi-Fi Photo Printer for Smartphone - The built-in hotspot of the photo printer makes it easy to print pictures from your phone, avoiding outside interference with a fast and stable connection. No other networks required! Simply connect your device to the independent instant photo printer 4x6 hotspot.
- Multiple Device Compatibility - Liene phone printer provides instant photo printing for up to 5 simultaneous connections. Share with family and friends or print from your different devices. No additional cables or Bluetooth required when printing photos with this picture printer. Note: Ensure the ink cartridge clicks into place before printing.
- Customize your Printing with the Liene App - Customize your photos with our specialized App! You can add a Square border, insert filters, enhance the contrast and brightness, check printing status, and more. You can even print your ID and Visa photos from home with this photo printer for iphone 4x6 prints.
Derive the PDF height from the source ratio
Choose one dimension and calculate the other. The units must match the jsPDF document’s units (for example, millimetres or points).
const canvas = await html2canvas(document.querySelector('#capture'), {
useCORS: true
});
const sourceWidth = canvas.width;
const sourceHeight = canvas.height;
const pdfWidth = 180; // millimetres in this example
const pdfHeight = pdfWidth * sourceHeight / sourceWidth;
const doc = new jspdf.jsPDF({ unit: 'mm', format: 'a4' });
doc.addImage(canvas.toDataURL('image PNG'), 'PNG', 15, 15, pdfWidth, pdfHeight);
doc.save('export.pdf');
If you prefer to fix the height, use pdfWidth = pdfHeight * sourceWidth / sourceHeight. Do not independently tune both numbers until the ratio matches.
Use the displayed element ratio when that is intentional
If the design intentionally crops an image with CSS, decide whether the PDF should preserve the uncropped source or reproduce the displayed crop. For a faithful crop, capture the element as rendered and place the resulting canvas at its canvas ratio. For the complete original image, capture the image itself and calculate placement from its intrinsic dimensions.
Fix distortion during html2canvas capture
html2canvas has separate controls for bitmap resolution, canvas dimensions, viewport dimensions, and cropping. Changing one does not automatically preserve another.
Recommended Free Tools
Rank #2
- Dock Photo Printer: The KODAK Dock Plus is a home photo printer that produces high-quality 4x6” prints directly from compatible smartphones. Featuring an integrated docking station, users can place their phone on the printer for better connection while simultaneously charging the device during printing.
- Genuine 4PASS dye sublimation printing: Each photo is produced in three color layers and finished with a clear protective lamination layer. In approximately 55 seconds, you receive a smooth, detailed print designed to resist fingerprints, water, and fading for long-lasting quality.
- Easy to Use: Print photos quickly without complicated setup or technical steps. Simply power on, connect wireless bluetooth, and start printing within seconds. The Dock Plus is built for straightforward operation, making it ideal for first time users and everyday photo printing.
- Home Printing Station: Designed for stable desktop use, this dock photo printer connects to a power outlet for consistent performance and larger 4x6” prints. Ideal for home printing, photo albums, framing, family events, and everyday picture printing.
- KODAK Photo Printer APP: Featuring integrated Bluetooth connectivity, this portable printer connects to compatible iOS and Android devices through the KODAK Photo Printer app. Edit, crop, and customize your photos before printing for creative results.
scale changes resolution, not PDF geometry
scale controls the rendering scale and defaults to window.devicePixelRatio. A higher value can improve sharpness, but it is not an aspect-ratio formula. Keep the same proportional width and height when setting explicit dimensions.
width, height, x, and y
width and height set canvas dimensions; x and y are crop offsets. Setting only one dimension or combining values copied from a different layout can make the captured result appear squeezed. Start without these overrides, then add only the control you need.
windowWidth and windowHeight
These define the window used while rendering and can change responsive layout and media-query results. If a tall or wide element is empty or cut off, try its scroll dimensions:
const element = document.querySelector('#capture');
const canvas = await html2canvas(element, {
windowWidth: element.scrollWidth,
windowHeight: element.scrollHeight,
scale: window.devicePixelRatio
});
Do not confuse windowWidth with CSS media-query behavior in the jsPDF HTML plugin; that plugin uses it for the actual container size, while its documentation says it does not alter CSS media queries.
Rank #3
- 2x3" Portable Photo Printer: The upgraded PP01 photo printer uses advanced inkjet technology. This portable photo printer produces vivid, full-color prints on premium sticky-backed photo paper that is smudge-proof, water-resistant, and tear-resistant. The Nelko mini photo printer is pocket-sized and weighs only 308g, making it ultra-portable for school, travel, and field trips. Each ink cartridge prints up to 80 full-color 2x3 photos on sticky-backed paper
- Easy Printing via Bluetooth: The PP01 mini photo printer is compatible with iOS and Android phones via Bluetooth. Simply download the Nelko app from Google Play or the App Store. Load the 2x3 photo paper with the smooth side facing down. Install the ink cartridge, connect via Bluetooth, and print directly using the Nelko app. A USB charging cable is included; the adapter is not included
- High Photo Quality: This mini photo printer uses advanced inkjet technology for clear, vibrant prints. This portable photo printer produces 600 DPI high-resolution images with precise colors, capturing fine details and realistic tones. Each photo comes with adhesive backing, perfect for scrapbooks and preserving your memories. Personalize every photo for holidays, birthdays, or daily events
- Powerful App: The Nelko 2x3" PP01 photo printer app lets you edit photos and offers a variety of frame designs, making it perfect for personalizing your photos for projects like scrapbooking or journaling. Download the Nelko app to create collages and customize photos with filters, graffiti, borders, stickers, text, AI image editing, and many other features. Edit photos on your phone, then send them to the Nelko app for instant printing in under 90 seconds
- Versatile Usage Scenarios: This portable photo printer is ideal for travel journals, party favors, and family gatherings. Students use it for planners and photo printing. Crafters use it for DIY projects, custom labels, and scrapbooking. It's a practical tool for bloggers, small businesses, and event photographers to create instant giveaways. Perfect for Mother's Day surprises and heartfelt moments with loved ones using Nelko sticky-backed photo paper.
Using doc.html() without a stretched result
The jsPDF HTML plugin’s width option is the target width in jsPDF units. The rendered element is scaled to fit that width, but the option has no effect when html2canvas.scale is specified or when windowWidth is not specified, according to the current plugin documentation. Check those conditions when changing width appears to do nothing.
const doc = new jspdf.jsPDF({ unit: 'mm', format: 'a4' });
doc.html(document.querySelector('#capture'), {
x: 15,
y: 15,
width: 180,
windowWidth: document.querySelector('#capture').scrollWidth,
callback: (pdf) => pdf.save('export.pdf')
});
When you need exact image placement, capturing with html2canvas and using addImage() gives you explicit control over both dimensions. When you need the HTML plugin’s pagination and layout, verify its width, window, and html2canvas settings together rather than changing scale alone.
Blank, missing, or clipped images are different problems
Cross-origin images
html2canvas cannot safely read cross-origin images unless the image server permits it. useCORS: true works only when the server sends an appropriate Access-Control-Allow-Origin header. Otherwise, host the asset on the same origin or use a same-origin proxy.
const canvas = await html2canvas(element, {
useCORS: true,
backgroundColor: '#ffffff'
});
A CORS failure commonly produces a blank image or a security exception, not a stretched one. Fix the origin and response headers before adjusting dimensions.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #4
- Dual 4x6" & 3x3" Photo Printer Paper Tray Convenience: Seamlessly print both 6-inch standard photo paper and 3-inch sticky-backed paper with our innovative dual tray design. This compact phone photo printer for smartphone offers easy storage and quick access, making it perfect for diverse printing needs without taking up much space. Enjoy vibrant, high-quality prints every time.
- Fast Bluetooth Connectivity: Experience lightning-fast printing with our liene photo printer's Bluetooth connection, which pairs in just 13 seconds. Enjoy a seamless and efficient printing experience, perfect for capturing and sharing memories on the go without the hassle of cables or complex setups.
- Superior Quality Photo Printer 4x6 - Print photos like no other thanks to the thermal-dye sublimation tech adopted by the picture printer for iphone. The dyes deeply penetrate the paper for vibrant photo printing, and the laminated surface is resistant to water, scratches, fingerprints and fading. Get Liene photo printers now as amazing gifts for yourself and your loved ones, print your happy moments together and keep your love forever!
- Multiple Device Compatibility - Liene picture printer for iphone provides instant photo printing for up to mutiple simultaneous connections. Share with family and friends or print from your different devices. No additional cables required when printing photos with this phone printer.
- Customize your Printing with the Liene App - Customize your photos with our specialized App! You can add a Polaroid border, insert filters, enhance the contrast and brightness, check printing status, and more. You can even print your ID and Visa photos from home with this iphone photo printer for 4x6 & 3x3 prints.
Canvas size limits
Browser limits vary and change with browser versions and device memory. The html2canvas FAQ gives rough context: Chrome/Chromium and desktop Safari are around 32,767 pixels per dimension; Chrome/Chromium is about 268 megapixels of area and Firefox about 472 megapixels. iOS Safari can be lower depending on RAM. Treat these as approximate limits, not guarantees. Reduce scale, split long content into pages, or capture smaller regions when a canvas is blank or truncated.
Unsupported CSS
html2canvas implements CSS properties manually and does not support every property equally. Reduce the page to a small reproducible case and check whether the layout itself is rendered differently before changing PDF dimensions.
A repeatable export recipe
- Wait for images and fonts to finish loading before capture.
- Record intrinsic image dimensions and the element’s rendered dimensions.
- Capture with html2canvas using proportional dimensions; use
scaleonly for resolution. - Inspect the canvas visually and log its dimensions.
- Choose a PDF width or height and derive the other from the canvas ratio.
- Place the image, then verify it at 100% zoom in the generated PDF.
- For multi-page documents, calculate available page height and start a new page instead of squeezing the image to fit.
Performance, reliability, and cost considerations
- Higher
scalemultiplies pixel count and memory use. Use the smallest scale that meets print or display requirements. - Very tall pages are more likely to hit browser canvas limits; split them logically rather than creating one enormous bitmap.
- Cache or reuse a captured canvas when generating several PDF formats, but keep an eye on memory for large bitmaps.
- Client-side html2canvas depends on
window,document, and computed styles. It is not a server-side screenshot engine; server workflows generally require a real browser such as Puppeteer or Playwright. - Confirm the installed jsPDF and html2canvas versions because their living documentation and defaults can change.
Or skip the browser setup
ScreenshotNeo provides a website screenshot API and MCP server when you need a rendered page or PDF without wiring a browser into your application. Cookie and consent banners, newsletter popups, and chat widgets are removed before capture. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP tools—take_screenshot, get_page_info, and capture_pdf—work with Claude, Cursor, and other MCP clients.
One-call cURL example
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)
r.raise_for_status()
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}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const bytes = new Uint8Array(await res.arrayBuffer());
await Bun.write('shot.webp', bytes);
See the full parameter list and response behavior in the ScreenshotNeo documentation. Every feature is included on every plan, including full-page lazy-image loading, CSS-selector element capture, dark mode, 12 device presets plus custom viewports, retina scale, PDF paper sizes and margins, custom CSS and JavaScript, clicks, waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, configurable caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Existing parameter names used by other screenshot APIs also work, which can simplify migration.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; yearly billing provides two months free. Create a free ScreenshotNeo account to try it.
Best Value
- Instant Photo Printing: The KODAK Mini 2 Retro is a portable photo printer designed to turn smartphone pictures into high quality prints in seconds. Whether capturing family moments, travel highlights, journaling pages, or creative projects, this mini printer lets you print real photos anytime, anywhere.
- Genuine 4PASS dye sublimation printing: Each photo is produced in three color layers and finished with a clear protective lamination layer. In approximately 55 seconds, you receive a smooth, detailed print designed to resist fingerprints, water, and fading for long-lasting quality.
- Easy to Use: Print photos quickly without complicated setup or technical steps. Simply power on, connect wireless bluetooth, and start printing within seconds. The Mini 2 Retro is built for straightforward operation, making it ideal for first time users and everyday photo printing.
- Print Anytime, Anywhere: Small enough to fit in your hand, bag, or even a pocket, the Mini 2 Retro is built for on-the-go printing. Ideal for parties, trips, school projects, scrapbooks, and spontaneous moments where you want real prints without waiting.
- KODAK Photo Printer APP: Featuring integrated Bluetooth connectivity, this portable printer connects to compatible iOS and Android devices through the KODAK Photo Printer app. Edit, crop, and customize your photos before printing for creative results.
Troubleshooting checklist
| Symptom | Likely cause | Fix |
|---|---|---|
| Canvas already looks squeezed | DOM or capture dimensions differ | Inspect CSS, remove arbitrary width/height overrides, and check viewport settings. |
| Canvas is correct, PDF is squeezed | Independent addImage() dimensions |
Derive height or width from the canvas ratio. |
doc.html() width seems ignored |
Conflicting html2canvas.scale or missing windowWidth |
Review the plugin’s documented conditions and set a consistent container width. |
| Image is blank | Cross-origin restriction or failed load | Wait for the image, enable useCORS with valid response headers, or proxy it. |
| Bottom or sides are cut off | Viewport mismatch or canvas limit | Match window dimensions to scroll dimensions, lower scale, or paginate. |
| Layout differs from the browser | Unsupported CSS or responsive breakpoint | Use a reproducible test case and adjust supported CSS or viewport dimensions. |
Frequently Asked Questions
Does increasing html2canvas scale fix a squished image?
No. Scale changes bitmap resolution. It can improve sharpness but does not correct independently chosen PDF width and height.
Which dimensions should I log first?
Log the image’s naturalWidth and naturalHeight, then canvas.width and canvas.height, followed by the dimensions passed to jsPDF.
Can html2canvas generate PDFs on a server without a browser?
No. It depends on browser APIs such as window and document. A server workflow needs a real browser automation tool or a screenshot service.
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.

