Jacob Collins Jacob is the JPedal Product Lead and specialises in PDF creation and manipulation. He also develops Salesforce backend systems and contributes to marketing and support. Outside work, he’s a 1900‑rated chess player, guitarist, and French learner.

PDF processing with Spring Boot (Tutorial)

2 min read

pdf spring boot

What is Spring Boot?

Spring Boot is a framework for efficiently building production level Java apps. It builds on top of the Spring framework by offering out of the box configuration and setup. It allows developers to build and deploy enterprise microservices and APIs with minimal tweaking required.

How to process PDF files?

JPedal is our Java PDF SDK which enables developers to convert, manipulate, print, and view PDF files within Java applications. It provides APIs for rendering PDFs to images, extracting text and metadata, manipulating pages, and much more! JPedal supports both server side and desktop use cases, making it suitable for integrating PDF functionality into web applications, or document processing pipelines.

Spring Boot PDF processing

Combining JPedal with Spring Boot allows developers to build web services which require processing PDFs. For example, a Spring Boot REST API could use JPedal to convert uploaded PDFs into images.

This provides the following benefits:

  • Scalability: Spring Boot handles concurrency and deployment, while JPedal manages the PDF processing
  • Simplicity: Minimal configuration for both the web layer (Spring Boot) and document layer (JPedal)
  • Extensibility: Easy to integrate with databases or other cloud services

Together, JPedal and Spring Boot form a robust stack for creating PDF driven Java applications with web capabilities.

How to set up a Spring Boot project with JPedal

Now we are going to make a simple microservice which converts PDFs into PNGs.

First, visit Sprint Initializr and create a new project. Add ‘Spring Web’ as a dependency.

Second, you will need to download a JPedal jar, and add it to your Java project.

Next, create a service class which will perform the PDF to PNG conversion:

Then create a new controller class which will handle the REST requests:

Finally, update the application.properties file to include the following settings:

spring.servlet.multipart.enabled=true
spring.servlet.multipart.max-file-size=20MB
spring.servlet.multipart.max-request-size=20MB

Now you can start the microservice using:

./mvnw spring-boot:run

Once the build completes, you can send a PDF to the microservice and have it converted:

curl -X POST http://localhost:8080/pdf/convert -F file=@/Users/Shared/inputFile.pdf -F page=1 -o output.png

Source code

All of the code in this article can be found on our GitHub: jpedal-springboot-example.

Download JPedal now

You may download a trial copy of JPedal to get familiar with how it works.

Learn more

Find out what else you can do with JPedal.

We can help you better understand the PDF format as developers who have been working with the format for more than 2 decades!



The JPedal PDF library allows you to solve these problems in Java


Jacob Collins Jacob is the JPedal Product Lead and specialises in PDF creation and manipulation. He also develops Salesforce backend systems and contributes to marketing and support. Outside work, he’s a 1900‑rated chess player, guitarist, and French learner.