load_document method
Leave feedback
On this page
Loads a document.
def load_document(self):
...
Returns: The loaded document.
import io
import os
from groupdocs.search.common import IDocumentLoader
class MyDocumentLoader(IDocumentLoader):
def __init__(self, file_path):
self.file_path = file_path
self.document_key = os.path.basename(file_path)
def close_document(self):
pass
def load_document(self):
extension = os.path.splitext(self.file_path)[1]
with open(self.file_path, "rb") as f:
buffer = f.read()
return io.BytesIO(buffer)
- class
IDocumentLoader
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.