MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / embedded_get

Function embedded_get

src_classic/__main__.py:349–362  ·  view source on GitHub ↗

Retrieve contents of an embedded file.

(args)

Source from the content-addressed store, hash-verified

347
348
349def 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
365def embedded_add(args):

Callers

nothing calls this directly

Calls 5

embfile_getMethod · 0.80
embfile_infoMethod · 0.80
open_fileFunction · 0.70
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…