Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pdfSplit

A small Java tool that renders PDF pages to images (PDFBox) with a custom bounded thread pool, built to turn large PDFs into per-page images fast.

On a ~1000-page document this cut a single-threaded render from ~50 minutes to ~2.5 minutes by parallelising the page-render step across a fixed pool, with back-pressure so memory stays bounded on big files.

Why it's built this way

Rendering each PDF page is CPU-bound and independent — an ideal parallel workload, but a naive "one thread per page" blows up memory on a 1000-page file. MulThreadUtil wraps a fixed-size pool where, once the work queue is full, the submitting (main) thread runs the task itself — a simple caller-runs back-pressure that keeps the number of in-flight page buffers bounded instead of letting a thousand renders pile up at once. Each page's DPI/metadata is detected (metadata-extractor, commons-imaging) so output resolution is chosen per document rather than hard-coded.

Stack

  • PDFBox — page rendering (PDFRenderer)
  • metadata-extractor / commons-imaging — image DPI / metadata detection
  • Custom fixed thread pool with caller-runs back-pressure (MulThreadUtil)
  • Java + Maven

Build & run

./mvnw clean package
# entry point: com.example.pdfsplit.pdfdeal.Test

Layout

  • MulThreadUtil.java — the bounded-pool parallel helper (the core idea)
  • ImageUtils.java — PDF → image rendering + DPI/metadata detection
  • TimeStatic.java — timing helpers used to measure the speed-up

License

MIT


Author: Bohea — independent industrial software engineer (Shenzhen). Operator HMIs · device integration · machine data into your customer's ERP. More runnable demos & engineering notes on the site.

About

Fast PDF→image rendering (PDFBox) with a custom bounded thread pool: ~1000 pages 50min→2.5min.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages