./serve.sh in this directory.
implementation("com.pdfcora:pdfcora-java:0.1.0")
Java 17 or newer, macOS and Linux on x86-64 and arm64. The engine is a native library inside the jar, reached through JNI, not the Foreign Function API, so it runs on the JDK most teams already have rather than requiring 22+.
try (PdfDocument document = PdfDocument.open(Path.of("contract.pdf"))) {
BufferedImage image = document.page(0).render(1024);
ImageIO.write(image, "png", new File("page-1.png"));
}
Every call on every document runs on one engine thread for the whole process, so calling from several threads is safe — the calls serialise rather than corrupting memory.
try (PdfDocument document = PdfDocument.open(Path.of("letter.docx"))) {
document.writeTo(Path.of("letter.pdf"));
}
for (PdfSignature signature : document.signatures()) {
if (!signature.coversWholeDocument()) {
// Valid, but content was appended after signing and is not protected.
}
PdfSignature.Verification result = signature.verify(bytes);
}
PdfRedaction.Report report = document.redact(List.of(
new PdfRedaction.Target.Region(0, rect),
new PdfRedaction.Target.TextMatches("account number")));
byte[] clean = document.toByteArray(); // always a full save
Pkcs12Signer signer = new Pkcs12Signer(Files.readAllBytes(identity), password);
byte[] signed = document.sign(PdfSignOptions.with(signer).reason("Approved"));
PdfDocument tagged = document.tagContent(blocks, "Quarterly report", "en");