1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#!/usr/bin/env vpython3
import sys
import pdfbox
from jnius import autoclass
pdfname = 'pdf.pdf'
if len(sys.argv) > 1:
pdfname = sys.argv[1]
signature = autoclass('org.apache.pdfbox.examples.examples.ShowSignature')
signature.showSignature('', pdfname)
parser.parse()
#org.apache.pdfbox.preflight.PreflightDocument
document = parser.getPreflightDocument()
document.validate()
result = document.getResult()
document.close()
if result.isValid():
print("The file:{} is a valid PDF/A-1b file".format(pdfname))
else:
print("The file: {} is not valid, error(s) :".format(pdfname))
for error in result.getErrorsList():
print(error.getErrorCode(), " : ", error.getDetails())
|