After upgrading to PDFBox 3, the PreflightParser.validate() function returns an error. "Trailer Syntax error, /XRef cross reference streams are not allowed"
Code:
fun isValid(bytes: ByteArray): Boolean {
val fileName = "tmp_${UUID.randomUUID()}.pdf"
val file = File(fileName)
val document = Loader.loadPDF(bytes)
document.save(fileName)
// This returns a ValidationError
val result = PreflightParser.validate(file)
return result.isValid
}
The tested PDFs are the same as before the upgrade.
ᐧ

