Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
JavaScript

How to Prevent Images Being Cut Between jsPDF Pages

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.

With a direct jsPDF addImage call, page placement is up to your code: check the image’s rendered height against the space left on the page before adding it. If it must stay whole and will not fit, start a new page and place it at the top content margin. If it is meant to continue across pages, paginate it deliberately. For HTML passed to doc.html(), configure autoPaging instead; that option does not control direct addImage calls.

First identify what is being cut

There are three different situations that can look like the same clipping bug. Pick the one that matches how you create the PDF; each needs a different fix.

  • A direct image placement should remain intact: use addImage, but move the entire image to the next page when it does not fit in the remaining content area.
  • One tall image should continue onto following pages: split it into page-sized portions, or deliberately place the tall image with a changing vertical offset on each page.
  • You render HTML with doc.html(): choose the HTML renderer’s autoPaging behavior and inspect the resulting layout.

The addImage API places image data at explicit x/y coordinates with explicit width and height in the document’s configured units. It does not automatically decide that an image should move intact to the next page. Check the jsPDF project for the version you use and consult its current API documentation for the precise methods and options available in that release.

Keep a direct image whole

Before calling addImage, calculate the image’s displayed height from the width you intend to use and its original aspect ratio. Compare that height with the space between the current y-coordinate and the bottom content margin. If it will not fit, call addPage(), reset y to the top content margin, and place the image there.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner
  • 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

Runnable browser example

This example assumes jsPDF is already loaded in a browser and that canvas is a populated canvas. The canvas is used here as image data; you can substitute a supported image data source. The document uses millimetres, so its margins and dimensions are also in millimetres.

const { jsPDF } = window.jspdf;
const doc = new jsPDF({ unit: 'mm', format: 'a4' });

const canvas = document.querySelector('#source-canvas');
if (!canvas || canvas.width === 0 || canvas.height === 0) {
  throw new Error('The source canvas is missing or has no image data.');
}

const margin = { top: 15, right: 15, bottom: 15, left: 15 };
const pageHeight = doc.internal.pageSize.getHeight();
const pageWidth = doc.internal.pageSize.getWidth();
const contentWidth = pageWidth - margin.left - margin.right;
const usableHeight = pageHeight - margin.top - margin.bottom;

// Preserve the source aspect ratio at the chosen content width.
const imageWidth = contentWidth;
const imageHeight = imageWidth * canvas.height / canvas.width;

if (imageHeight > usableHeight) {
  throw new Error('This image is taller than one page’s usable area; scale it down or paginate it.');
}

let y = margin.top;
if (y + imageHeight > pageHeight - margin.bottom) {
  doc.addPage();
  y = margin.top;
}

doc.addImage(canvas, 'PNG', margin.left, y, imageWidth, imageHeight);
doc.save('image.pdf');

For a sequence of images, apply the same fit check to each one before placing it. If an image is wider than the content area, decide whether to scale it down or intentionally allow a different layout; do not calculate its height from a width that exceeds the page’s usable width.

How the fit check works

  • Use the document’s units consistently. The page dimensions, margins, coordinates, and image dimensions must all use the unit configured for jsPDF.
  • Preserve aspect ratio. For source dimensions sourceWidth by sourceHeight, displayed height is displayedWidth × sourceHeight ÷ sourceWidth.
  • Compare against the bottom content boundary. The remaining usable space is the page height minus the bottom margin minus the current y-coordinate.
  • Check oversized images separately. Moving an image to a fresh page cannot make an image taller than the page’s usable area fit. Scale it down or paginate it.

Let one tall image continue onto multiple pages

If the requirement is to make a continuous long screenshot readable across pages, moving the whole image is not the solution. A community example uses a height-left loop and offsets repeated placements. That pattern can work, but its dimensions and initial position must be adapted to your own page size and margins; it should not be copied as a universal set of constants.

Rank #2
Sale
Brother DS-640 Compact Mobile Document Scanner, (Model: DS640)
  • 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)

A more controlled approach is to crop the source into consecutive page-sized portions, then place one portion per page at the same top content position. The following browser example creates those portions from a canvas. It uses the same width on every page, preserves the image ratio, and stops at the actual source-image end instead of relying on a loop that might create an empty trailing page.

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.
const { jsPDF } = window.jspdf;
const doc = new jsPDF({ unit: 'mm', format: 'a4' });
const canvas = document.querySelector('#source-canvas');

if (!canvas || canvas.width === 0 || canvas.height === 0) {
  throw new Error('The source canvas is missing or has no image data.');
}

const margin = { top: 15, right: 15, bottom: 15, left: 15 };
const pageHeight = doc.internal.pageSize.getHeight();
const pageWidth = doc.internal.pageSize.getWidth();
const outputWidth = pageWidth - margin.left - margin.right;
const outputHeight = pageHeight - margin.top - margin.bottom;
const pixelsPerMm = canvas.width / outputWidth;
const sliceHeightPx = Math.floor(outputHeight * pixelsPerMm);

if (sliceHeightPx < 1) {
  throw new Error('The page layout leaves no usable image height.');
}

for (let sourceY = 0; sourceY < canvas.height; sourceY += sliceHeightPx) {
  const currentSliceHeight = Math.min(sliceHeightPx, canvas.height - sourceY);
  const slice = document.createElement('canvas');
  slice.width = canvas.width;
  slice.height = currentSliceHeight;
  const context = slice.getContext('2d');
  if (!context) throw new Error('Could not create a canvas context.');
  context.drawImage(
    canvas,
    0, sourceY, canvas.width, currentSliceHeight,
    0, 0, canvas.width, currentSliceHeight
  );

  if (sourceY > 0) doc.addPage();
  const sliceHeightMm = currentSliceHeight / pixelsPerMm;
  doc.addImage(slice, 'PNG', margin.left, margin.top, outputWidth, sliceHeightMm);
}

doc.save('long-image.pdf');

This crop-based method produces page-sized pieces rather than placing the same full image repeatedly. If you use the offset approach instead, calculate the visible interval for each page from the content area, adjust the image’s y-coordinate on every new page, and add headers or footers explicitly on each page. A jsPDF issue opened in 2019 reports inconsistent requested header/footer offsets on later pages in one long-table-image case; treat it as a practical warning to inspect your own output, not as a guarantee about every jsPDF version or layout.

Choose automatic paging for HTML input

autoPaging is an option for the HTML rendering path, not an image keep-together switch for addImage. The jsPDF HTML API documents a default of true, and describes these explicit choices:

Rank #3
Sale
Epson Workforce ES-400 II High-Speed Color Duplex Desktop Document Scanner
  • 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
  • false: disables automatic paging. Use it only when you will manage page placement yourself.
  • 'slice': permits content such as shapes or text chunks to be cut at page breaks.
  • 'text': tries to avoid cutting text in half and is described as working best for mostly single-column documents.

For example, configure the option when invoking the HTML method:

doc.html(document.querySelector('#report'), {
  x: 10,
  y: 10,
  margin: [15, 15, 15, 15], // top, right, bottom, left
  autoPaging: 'text',
  callback: (finishedDoc) => finishedDoc.save('report.pdf')
});

Switch to 'slice' if cutting content at page boundaries is acceptable, or to false if you are arranging pages yourself. The HTML API does not promise that 'text' will keep every image, chart, or table intact. Inspect those elements in the generated PDF, especially when their position relative to text matters. The jsPDF TypeScript declarations also expose HTML paging options; verify the declaration that matches your installed version rather than assuming a setting exists in every release.

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

Set margins and page decorations per page

Margins are your layout rules; they are not automatic safe space for every direct image placement. For each page, define the usable area as page height minus top and bottom margins. For a split image, use that same content interval on every page. If your PDF has a header or footer, draw it for each page explicitly and keep the image’s visible portion inside the remaining interval. Do not assume that the first page’s y-offset will be reproduced as a matching header/footer layout on later pages.

Rank #4
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
  • Scanner type: Document
  • Connectivity technology: USB
  • With Auto Scan Mode, the scanner automatically detects what you're scanning
  • Digitize documents and images

With the HTML method, the documented margin array is ordered top, right, bottom, left. Keep the values in the document’s configured unit and check the effect on both the first page and later pages.

Troubleshoot clipped or misplaced images

The image is cut off at the bottom

  • Cause: the image’s y-coordinate plus displayed height extends below the usable page area.
  • Fix: calculate the rendered height, include the bottom margin in the fit check, and move a keep-whole image to a new page before calling addImage.

The image remains too tall on a new page

  • Cause: it exceeds the usable height of an entire page.
  • Fix: scale it to the content area or intentionally split it into page portions. A page break alone cannot solve this case.

Later pages lose the expected header or margin

  • Cause: the code handles the initial placement but does not recalculate the visible area or draw page decorations for each added page.
  • Fix: use the same per-page content boundaries throughout and add headers and footers to every page. Review the exported PDF rather than inferring later-page layout from the first one.

HTML pagination cuts a chart, image, or table

  • Cause: autoPaging: 'text' is intended to avoid splitting text and is best suited to mostly single-column documents; it does not promise to keep every non-text element whole.
  • Fix: try a layout that avoids placing the element across a page boundary, or control pagination yourself. Check each affected page in the PDF.

The PDF ends with an unintended blank page

  • Cause: page creation happens after the last portion has already filled the source image, or the loop’s boundary condition treats an exact fit as another page.
  • Fix: add a page only before a portion that actually exists. The crop example loops only while source pixels remain and adds a page only when sourceY > 0.

The output is stretched or unexpectedly large

  • Cause: width and height were supplied independently without preserving the source aspect ratio, or calculations mixed document units with pixel dimensions.
  • Fix: derive the displayed height proportionally from the chosen displayed width. Convert pixel slice sizes to document units using a consistent scale, as in the crop example.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance, reliability, and output checks

Very tall images and high-resolution canvases require more memory than small page-sized images; creating crop canvases also allocates image data for each portion. If a browser runs out of memory, reduce the source resolution or process smaller portions and release temporary canvases when they are no longer needed. Preserve enough resolution for the PDF’s intended viewing or printing; shrinking the source may reduce detail.

Reliability comes from explicit boundaries, not a magic paging flag: use a single unit system, compute the dimensions from the actual page, handle images taller than one page, and check the last page for clipping or blank space. For HTML, inspect tables and visual elements as well as text. Test the exact jsPDF version and output path used by your application because HTML rendering and direct image placement follow different logic.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
ScanSnap iX2500 Wireless or USB High-Speed Document Scanner, Black
  • 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

Or skip the browser setup

If your input is a public webpage screenshot rather than an image you already have, ScreenshotNeo can return a screenshot image or PDF through one GET request. The example below requests a WebP screenshot; add your key and use the returned image as the source for your own PDF layout. See the ScreenshotNeo API documentation for request options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers indicate the page verdict and billing status. Its MCP server provides screenshot tools for AI agents, including Claude, Cursor, and other MCP clients. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for 1,000 free screenshots a month with no card.

Frequently Asked Questions

Does jsPDF automatically move an image to the next page?

No. For a direct addImage call, check the remaining content height and add the page break in your own code.

Which autoPaging setting avoids splitting text?

The HTML API’s 'text' mode tries to avoid splitting text and is best suited to mostly single-column documents; it does not guarantee that images, charts, or tables remain intact.

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

Quick Recap

Bestseller No. 4
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Scanner type: Document; Connectivity technology: USB; With Auto Scan Mode, the scanner automatically detects what you're scanning
$75.00

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.