DocumentFormatInstance Class |
Namespace: GroupDocs.Redaction.Integration
The DocumentFormatInstance type exposes the following members.
Name | Description | |
---|---|---|
![]() | DocumentFormatInstance | Initializes a new instance of the DocumentFormatInstance class |
Name | Description | |
---|---|---|
![]() | Password |
Gets or sets a password for password protected documents.
|
Name | Description | |
---|---|---|
![]() | Equals | (Inherited from Object.) |
![]() | Finalize | (Inherited from Object.) |
![]() | GetHashCode | (Inherited from Object.) |
![]() | GetType | (Inherited from Object.) |
![]() ![]() | Initialize |
Performs initialization of the instance of document format handler.
|
![]() | IsRedactionAccepted |
Checks for IRedactionCallback implementation and invokes it, if specified.
|
![]() | Load |
Loads the document from a stream.
|
![]() | MemberwiseClone | (Inherited from Object.) |
![]() | PerformBinaryCheck |
Checks if the given stream contains a document, supported by this format instance.
|
![]() | Save |
Saves the document to a stream.
|
![]() | SetAccessGranted |
Sets a validation status, if the document requires password.
|
![]() | ToString | (Inherited from Object.) |
public class DummyDocument : DocumentFormatInstance { public override void Load(Stream output) { // load file content } public override void Save(Stream output) { // save changes to file; } }
The following example demonstrates how to use the initialization data.
public class MyCustomHandler : DocumentFormatInstance { private string MyProperty { get; set; } // Other custom code ... public override void Initialize(DocumentFormatConfiguration config) { base.Initialize(config); if (config.InitializationData.ContainsKey("MyProperty")) { MyProperty = config.InitializationData["MyProperty"]; } } } // Plugging custom format into GroupDocs.Redaction var mySettings = new DocumentFormatConfiguration(); mySettings.ExtensionFilter = ".foo"; mySettings.DocumentType = typeof(MyCustomHandler); mySettings.InitializationData.Add("MyProperty", "bar"); var configuration = RedactorConfiguration.GetInstance(); configuration.AvailableFormats.Add(mySettings);