mlodic / pdfid

MIT License
13 stars 4 forks source link

Added support for file buffer objects #3

Closed IV1T3 closed 2 years ago

IV1T3 commented 2 years ago

This PR now supports to instantiate a pdfid.PDFiDMain() object from file buffer objects.

Instead of just passing filenames, it now supports objects already in memory as shown below.

filenames = ["./test"]
options = pdfid.get_fake_options()
options.scan = True
options.json = True

file_buffers = []
for filename in filenames:
    with open(filename, "rb") as f:
        file_buffers.append(f.read())

# PDFiDMain now takes file_buffers as its third parameter
list_of_dict = pdfid.PDFiDMain(filenames, options, file_buffers)
print(list_of_dict)
mlodic commented 2 years ago

thank you for this PR! Do I consider this version as final? (Can I merge it or you are still working on it?)

IV1T3 commented 2 years ago

Yeah, you can consider this as final for now and merge it with main! Thank you for writing this wrapper library around Didiers' pdfid!