Exemplo n.º 1
0
args = parser.parse_args()

pdf = Pdf().load(args.pdf)

if args.compare:
    other = Pdf().load(args.compare)
    for k, v in pdf.objects.items():
        if k not in other.objects:
            print('===== {} ===== missing from other'.format(k))
        if other.objects[k] != v:
            print(('===== {} =====\n'
                   '{}\n'
                   '\n'
                   '===== other =====\n'
                   '{}').format(k, v, other.objects[k]))
    for k in other.objects.keys():
        if k not in pdf.objects:
            print('===== {} ===== missing'.format(k))
if args.templatify_forms:
    if args.templatify_forms_uniquifier:
        pdf.uniquifier = args.templatify_forms_uniquifier
    pdf.templatify_forms_padding = args.templatify_forms_padding
    pdf.templatify_forms_custom_padding = eval(
        args.templatify_forms_custom_padding)
    pdf.templatify_forms(
        whitelist=[int(i) for i in args.templatify_forms_whitelist.split()],
        remove_dv=args.templatify_forms_remove_dv,
    )
if args.save:
    pdf.save(args.save)