Make final PDF/A output message less obtuse
This commit is contained in:
+5
-2
@@ -1419,9 +1419,12 @@ def run_pipeline():
|
||||
if options.output_type == 'pdfa':
|
||||
pdfa_info = file_claims_pdfa(options.output_file)
|
||||
if pdfa_info['pass']:
|
||||
_log.info(pdfa_info['message'])
|
||||
msg = 'Output file is a {} (as expected)'
|
||||
_log.info(msg.format(pdfa_info['conformance']))
|
||||
else:
|
||||
_log.warning(pdfa_info['message'])
|
||||
msg = 'Output file was generated but is not PDF/A (seems to be {})'
|
||||
_log.warning(msg.format(pdfa_info['conformance']))
|
||||
|
||||
return ExitCode.invalid_output_pdf
|
||||
|
||||
if not qpdf.check(options.output_file, _log):
|
||||
|
||||
+5
-4
@@ -135,7 +135,8 @@ def file_claims_pdfa(filename):
|
||||
aboutUri='',
|
||||
namespace='http://www.aiim.org/pdfa/ns/id/')
|
||||
except AttributeError:
|
||||
return {'pass': False, 'output': 'pdf', 'message': 'No XMP metadata'}
|
||||
return {'pass': False, 'output': 'pdf',
|
||||
'conformance': 'No XMP metadata'}
|
||||
|
||||
pdfa_dict = {attr.localName: attr.value for attr in pdfa_nodes}
|
||||
pdfa_dict['pass'] = False
|
||||
@@ -144,15 +145,15 @@ def file_claims_pdfa(filename):
|
||||
part_conformance = pdfa_dict['part'] + pdfa_dict['conformance']
|
||||
valid_part_conforms = {'1A', '1B', '2A', '2B', '2U', '3A', '3B', '3U'}
|
||||
|
||||
message = 'File claims to be PDF/A-{}'.format(
|
||||
conformance = 'PDF/A-{}'.format(
|
||||
part_conformance)
|
||||
|
||||
if part_conformance in valid_part_conforms:
|
||||
pdfa_dict['pass'] = True
|
||||
pdfa_dict['output'] = 'pdfa'
|
||||
pdfa_dict['message'] = message
|
||||
pdfa_dict['conformance'] = conformance
|
||||
else:
|
||||
pdfa_dict['message'] = 'File is a regular PDF'
|
||||
pdfa_dict['conformance'] = 'PDF'
|
||||
|
||||
return pdfa_dict
|
||||
|
||||
|
||||
Reference in New Issue
Block a user