Retrieve contents of an embedded file.
(args)
| 347 | |
| 348 | |
| 349 | def embedded_get(args): |
| 350 | """Retrieve contents of an embedded file.""" |
| 351 | doc = open_file(args.input, args.password, pdf=True) |
| 352 | try: |
| 353 | stream = doc.embfile_get(args.name) |
| 354 | d = doc.embfile_info(args.name) |
| 355 | except ValueError: |
| 356 | sys.exit("no such embedded file '%s'" % args.name) |
| 357 | filename = args.output if args.output else d["filename"] |
| 358 | output = open(filename, "wb") |
| 359 | output.write(stream) |
| 360 | output.close() |
| 361 | print("saved entry '%s' as '%s'" % (args.name, filename)) |
| 362 | doc.close() |
| 363 | |
| 364 | |
| 365 | def embedded_add(args): |
nothing calls this directly
no test coverage detected
searching dependent graphs…