DocumentFormatInstance class
Leave feedback
On this page
Represents a specific format of a document and can be implemented to add custom document types.
Learn more
- More details about implementing custom formats: https://docs.groupdocs.com/redaction/net/create-custom-format-handler/
The DocumentFormatInstance type exposes the following members:
| Method | Description |
|---|---|
| initialize | Initializes the document format handler instance. |
| initialize_document_format_configuration | |
| is_redaction_accepted | Checks for IRedactionCallback implementation and invokes it, if specified. |
| is_redaction_accepted_redaction_description | |
| load | Loads the document from a stream. |
| load_stream | |
| load_streams | |
| perform_binary_check | Checks if the given stream contains a document supported by this format instance. |
| perform_binary_check_stream | |
| perform_binary_check_streams | |
| save | Saves the document to a stream. |
| save_stream | |
| save_streams |
| Property | Description |
|---|---|
| password | The password for password-protected documents. |
class DummyDocument(DocumentFormatInstance):
def load(self, output: io.RawIOBase) -> None:
# load file content
pass
def save(self, output: io.RawIOBase) -> None:
# save changes to file
pass
class MyCustomHandler(DocumentFormatInstance):
def __init__(self):
self.my_property = None
def initialize(self, config: DocumentFormatConfiguration) -> None:
super().initialize(config)
if "MyProperty" in config.initialization_data:
self.my_property = config.initialization_data["MyProperty"]
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.