Hello,
It appears that libpdfbox2 has command-line utilities for end users: https://pdfbox.apache.org/2.0/commandline.html
However this package doesn't install anything in /usr/bin/ where users will like to find them. I don't know anything about Java, so getting this to work has been challenging. Invoking the .jar manually one finds
$ java -jar /usr/share/java/pdfbox2-tools.jar
no main manifest attribute, in /usr/share/java/pdfbox2-tools.jar
(Note that the upstream documentation I linked to refers to a "pdfbox*-app.jar" which isn't installed anywhere; maybe we just need to build it?
After some guessing I found a command-line that works:
$ java -cp '/usr/share/java/pdfbox2-tools.jar:/usr/share/java/pdfbox2.jar' org.apache.pdfbox.tools.PDFBox
PDFBox version: "2.0.29"
Usage: java -jar pdfbox-app-x.y.z.jar <command> <args..>
Possible commands are:
Decrypt
Encrypt
ExtractText
ExtractXMP
ExtractImages
OverlayPDF
PrintPDF
PDFMerger
PDFReader
PDFSplit
PDFToImage
TextToPDF
WriteDecodedDoc
(Note that this command-line help also refers to my invocation as "pdfbox-app"; maybe that's supposed to be a wrapper that sets stuff up correctly?)
I think some wizardry in the javahelper package exists to set up the right bits. However you should probably see if the upstream build system has a way to set things up. For example, the ImportXFDF command https://sources.debian.org/src/libpdfbox2-java/2.0.29-1/tools/src/main/java/org/apache/pdfbox/tools/ImportXFDF.java isn't recognized, but it can still be used with a tweak:
CLASSPATH="/usr/share/java/pdfbox2-tools.jar:/usr/share/java/pdfbox2.jar" java org.apache.pdfbox.tools.ImportXFDF