List embedded files.
(args)
| 445 | |
| 446 | |
| 447 | def embedded_list(args): |
| 448 | """List embedded files.""" |
| 449 | doc = open_file(args.input, args.password, pdf=True) |
| 450 | names = doc.embfile_names() |
| 451 | if args.name is not None: |
| 452 | if args.name not in names: |
| 453 | sys.exit("no such embedded file '%s'" % args.name) |
| 454 | else: |
| 455 | print() |
| 456 | print( |
| 457 | "printing 1 of %i embedded file%s:" |
| 458 | % (len(names), "s" if len(names) > 1 else "") |
| 459 | ) |
| 460 | print() |
| 461 | print_dict(doc.embfile_info(args.name)) |
| 462 | print() |
| 463 | return |
| 464 | if not names: |
| 465 | print("'%s' contains no embedded files" % doc.name) |
| 466 | return |
| 467 | if len(names) > 1: |
| 468 | msg = "'%s' contains the following %i embedded files" % (doc.name, len(names)) |
| 469 | else: |
| 470 | msg = "'%s' contains the following embedded file" % doc.name |
| 471 | print(msg) |
| 472 | print() |
| 473 | for name in names: |
| 474 | if not args.detail: |
| 475 | print(name) |
| 476 | continue |
| 477 | _ = doc.embfile_info(name) |
| 478 | print_dict(doc.embfile_info(name)) |
| 479 | print() |
| 480 | doc.close() |
| 481 | |
| 482 | |
| 483 | def extract_objects(args): |
nothing calls this directly
no test coverage detected
searching dependent graphs…