when loading a PDF with PDFBox one gets log-level warnings if the PDF is erroneous:
PDDocument doc = PDDocument.load (new File (filename));