matteosecli / matteosecli/pdf2archive
perhaps switch validator so as to support newest versions of java?
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 87
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
I have found that the [current](https://github.com/matteosecli/pdf2archive/tree/master/verapdf) `verapdf` validator errors on newer versions of `java`:
```
$ java -version
openjdk version "15.0.2" 2021-01-19
OpenJDK Runtime Environment (build 15.0.2+7)
OpenJDK 64-Bit Server VM (build 15.0.2+7, mixed mode)
```
and then
```
$ ./pdf2archive --validate ~/Downloads/boo.pdf
=== Welcome to PDF2ARCHIVE ===
GPL Ghostscript 9.54.0: Unrecoverable error, exit code 1
Creating the definition file...
Compressing PDF & embedding fonts...
Converting to PDF/A-1B...
Removing temporary files...
Done, now ESSE3 is happy! ;)
Validating...
./verapdf/verapdf: line 125: [: 150 2021-01-19: integer expression expected
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at org.verapdf.apps.Applications.createConfigManager(Applications.java:75)
at org.verapdf.apps.Applications.createAppConfigManager(Applications.java:87)
at org.verapdf.cli.VeraPdfCli.(VeraPdfCli.java:46)
at org.verapdf.apps.GreenfieldCliWrapper.main(GreenfieldCliWrapper.java:34)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 4 more
```
On the other hand, I've found [this](https://pdfbox.apache.org/) `java` pdf library, that comes with a convenient [command-line validator](https://www.apache.org/dyn/closer.lua/pdfbox/3.0.0-RC1/preflight-app-3.0.0-RC1.jar) (a `jar` file).
I have checked that it agrees with your current `vera` validator on a number of files, both pre- and post-conversion. Before:
```
$ java -jar ~/Downloads/preflight-app-3.0.0-RC1.jar ~/Downloads/boo.pdf
---
The file boo.pdf is not a valid PDF/A-1b file, error(s) :
1.2.1 : Body Syntax error, EOL expected before the 'endobj' keyword at offset 471948
1.2.1 : Body Syntax error, EOL expected before the 'endobj' keyword at offset 475853
1.2.1 : Body Syntax error, EOL expected before the 'endobj' keyword at offset 468071
...
```
After:
```
$ java -jar ~/Downloads/preflight-app-3.0.0-RC1.jar ~/Downloads/boo-PDFA.pdf
---
The file boo-PDFA.pdf is a valid PDF/A-1b file
```
This works on both
```
$ java -version
---
openjdk version "15.0.2" 2021-01-19
OpenJDK Runtime Environment (build 15.0.2+7)
OpenJDK 64-Bit Server VM (build 15.0.2+7, mixed mode)
```
and
```
$ java -version
---
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~20.04-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
```
(the two versions I have handy right now).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the verapdf/verapdf wrapper, especially line 125, and run ./pdf2archive --validate with the Java 15 version shown in the report. Check the validator invocation and its compatibility with newer Java, then confirm validation works for converted and unconverted PDFs as in the examples while remaining consistent with the current validator.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, shell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100