For a Spring Boot MVC endpoint, accept the PDF as multipart form data, set finite limits for both the uploaded file and the whole request, then pass the upload to a version-matched Apache PDFBox API and close the document promptly. Upload limits do not cap parsing memory: robust handling also requires a plan for temporary disk use, concurrency, timeouts, and untrusted files.
How do I upload a large PDF in Spring Boot?
Spring MVC’s multipart support is autoconfigured. Configure the maximum size of an individual file and the maximum size of the complete multipart request separately:
As an Amazon Associate I earn from qualifying purchases.
spring.servlet.multipart.max-file-size=50MB
spring.servlet.multipart.max-request-size=55MB
These values are illustrative service settings, not universal recommendations. Choose limits from the files your service is intended to accept and the resources available in production. The request limit must accommodate the file plus multipart framing and any other form parts. Spring’s uploading files guide demonstrates both properties, but its sample value of 128KB is only an example—not a large-file production setting.
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 problemsWhen a request exceeds a limit, return a clear client error rather than increasing limits without considering the resulting resource demand. Check the whole deployed path: reverse proxies, ingress controllers, gateways, hosting limits, and request timeouts must all permit the intended upload.
#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
Account for staging and temporary storage
A multipart upload may be staged by the Servlet container, and the application may create another copy if it transfers the part to a separate file. Determine which temporary directory is used, how much space is available there, and how simultaneous uploads affect capacity. PDFBox may also use scratch storage while parsing. Restrict temporary-directory permissions, monitor free space, and define how uploaded files are cleaned up and retained.
Does Spring Boot keep multipart uploads in memory?
There is no single answer for every Spring stack and version. This MVC multipart flow should not be assumed to behave like WebFlux. WebFlux has separate multipart readers and configuration; the Spring Framework API documents default non-streaming behavior in which smaller parts remain in memory and larger parts are stored in temporary files. WebFlux versions and Spring Boot properties can differ, so check the documentation matching the versions actually deployed before relying on a threshold, streaming option, or temporary-directory setting.
Rank #2
- 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
If reactive backpressure or streaming upload handling is not a requirement, MVC’s multipart path is the more direct choice for the endpoint described here. A reactive flow using PartEvent is a different API and resource model from accepting a MultipartFile; neither framework choice eliminates the need to budget disk and memory.
How can I extract text from a PDF in Java?
Apache PDFBox can extract Unicode text from PDF files. A typical endpoint should load from a controlled file or input source, extract text, and close the document in a resource-safe scope such as try-with-resources where supported by the API. Avoid holding large extracted strings or page-related objects longer than needed.
Rank #3
- 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)
Use loading and cache APIs that match the PDFBox version in your dependency. The PDFBox 3 migration guide describes incremental parsing and the move to a StreamCacheCreateFunction and ScratchFile choices. PDFBox 2.x examples instead use MemoryUsageSetting, including setupTempFileOnly() and setupMixed(...) in the 2.x FAQ. Do not copy a 2.x loading snippet unchanged into a 3.x project.
PDFBox 3’s incremental parsing can reduce initial memory use when only part of a document is accessed. It is not a guarantee of constant or low memory use for a full-document workflow: visiting every page or accessing other document structures can load more data over time. A disk-backed cache shifts some pressure from heap to temporary storage; it does not remove the need to limit, monitor, and clean up that storage.
Rank #4
- 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
How do I prevent OutOfMemoryError when processing a PDF?
Treat upload acceptance and PDF parsing as separate resource decisions. A file that passes the multipart limit may still require substantial memory or disk during parsing. Set finite request and file limits, constrain parsing concurrency, and test representative documents under the resource limits of the deployed JVM and container. Do not infer a universally safe maximum PDF size or memory allowance from the upload setting alone.
- Budget both heap and temporary disk for upload staging and PDFBox cache behavior.
- Put timeouts and concurrency controls around parsing so slow or numerous requests cannot consume the service indefinitely.
- Use JVM and container resource limits, and consider isolating parsing from latency-sensitive request threads when workload demands justify it.
- Keep temporary storage access restricted and capacity monitored, and clean up according to the application’s retention policy.
- For untrusted documents processed at scale, follow PDFBox’s security guidance on timeouts, memory and resource limits, and sandboxing; review current security notices and keep the dependency updated.
Parsing successfully is not a trust or compliance check. PDFBox notes that signatures, permissions, and PDF/A conformance are not automatically validated just because a document was parsed or its text extracted; applications must explicitly call relevant verification APIs when they need those checks.
Best Value
- FITS SMALL SPACES AND STAYS OUT OF THE WAY. Innovative space-saving design to free up desk space, even when it's being used
- SCAN DOCUMENTS, PHOTOS, CARDS, AND MORE. Handles most document types, including thick items and plastic cards. Exclusive QUICK MENU lets you quickly scan-drag-drop to your favorite computer apps
- GREAT IMAGES EVERY TIME, NO EXPERIENCE REQUIRED. A single touch starts fast, up to 30ppm duplex scanning with automatic de-skew, color optimization, and blank page removal for outstanding results without driver setup
- SCAN WHERE YOU WANT, WHEN YOU WANT. Connect with USB or Wi-Fi. Send to Mac, PC, mobile devices, and cloud services. Scan to Chromebook using the mobile app. Can be used without a computer
- PHOTO AND DOCUMENT ORGANIZATION MADE EFFORTLESS. ScanSnap Home all-in-one software brings together all your favorite functions. Easily manage, edit, and use scanned data from documents, receipts, business cards, photos, and more
Why can extracted PDF text look wrong or be missing?
Text extraction is not OCR, and it does not guarantee the visual reading order a person sees on the page. PDFBox’s FAQ explains that extraction follows the sequence of text in the page content stream. Layout choices in a PDF can therefore produce surprising ordering, and image-only scans may yield no useful text through text extraction alone.
If scanned documents matter, treat OCR as a separate pipeline requirement. Test representative files for scan quality, language, and layout fidelity, and decide whether the application needs OCR or additional layout reconstruction. Do not assume every scan can be detected automatically or that PDFBox text extraction alone will read it.
Should PDF processing be synchronous or queued?
Synchronous parsing keeps the request-and-response flow simple, but ties request handling to parsing latency. A queued worker design adds job tracking and retry behavior, while allowing parsing to be isolated from request threads. Choose based on expected document complexity, response-time requirements, and the operational need to control worker concurrency; there is no benchmark here establishing one approach as universally faster or more memory-efficient.
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 →Which implementation choices matter most?
| Choice | What to weigh |
|---|---|
| MVC multipart or WebFlux streaming | Framework fit, buffering behavior, API complexity, and whether reactive backpressure is needed. Verify version-specific WebFlux behavior and settings. |
| Memory or scratch-file cache | Available heap, temporary disk capacity, concurrency, cleanup, and latency. Disk-backed caching trades some memory pressure for disk use. |
| PDFBox 2.x or 3.x | Dependency support policy and the matching version’s loading and cache API. Migration is not just a dependency-number change for cache configuration. |
| Text extraction or OCR | Whether documents contain embedded text, plus scan quality, language, layout fidelity, processing cost, and isolation needs. |
| Synchronous parsing or queued work | Request simplicity and response latency versus retries, job tracking, and worker isolation. |
The PDFBox project page reported version 3.0.8, released July 11, 2026. Release information changes; check the official project and security pages when choosing a dependency version.
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.




