Found recently quite interesting project:
Caradoc is a parser and validator of PDF files written in OCaml. This is version 0.3 (beta).
Caradoc provides many commands to analyze PDFs, as well as an interactive user interface in console.
Caradoc was presented at the the third Workshop on Language-Theoretic Security (LangSec) in May 2016. More information is available on the website of the conference.
See the project here GitHub - caradoc-org/caradoc: A PDF parser and validator