<dependency> <groupId>org.apache.pdfbox</groupId> <artifactId>pdfbox</artifactId> <version>2.0.23</version> </dependency> If you're using Gradle, add the following dependency to your build.gradle :
// Create a content stream and write text try (PDPageContentStream contents = new PDPageContentStream(document, page)) { // Set font and font size contents.setFont(PDType1Font.HELVETICA_BOLD, 24); java:pdf
import java.io.File; import java.io.IOException; <dependency> <groupId>org