Click or drag to resize

DocumentViewerDocumentHandlerParameters Property

Gets or sets a name-value collection of parameters which will be passed to your IDocumentHandler implementation specified in DocumentHandlerType.

Namespace:  GleamTech.DocumentUltimate.AspNet.UI
Assembly:  GleamTech.DocumentUltimate (in GleamTech.DocumentUltimate.dll) Version: 5.4.2
Syntax
public DocumentHandlerParameters DocumentHandlerParameters { get; set; }

Property Value

Type: DocumentHandlerParameters
Examples

Sample IDocumentHandler implementation for passing multiple parameters at once:

public class MultiParameterDocumentHandler : IDocumentHandler
{
    public DocumentInfo GetInfo(string inputFile, DocumentHandlerParameters handlerParameters)
    {
        // Get your parameters that were set in documentViewer.DocumentHandlerParameters property
        // The type for the generic Get<T> method should be the same as the set value's type.
        var parameter1 = handlerParameters.Get<string>("parameter1");
        var parameter2 = handlerParameters.Get<int>("parameter2");
        var parameter3 = handlerParameters.Get<string[]>("parameter3");

        // Do your thing with these parameters and construct and return your info

        return new DocumentInfo(uniqueId, fileName);
    }

    public StreamResult OpenRead(string inputFile, InputOptions inputOptions, DocumentHandlerParameters handlerParameters)
    {
        // Get your parameters that were set in documentViewer.DocumentHandlerParameters property
        // The type for the generic Get<T> method should be the same as the set value's type.
        var parameter1 = handlerParameters.Get<string>("parameter1");
        var parameter2 = handlerParameters.Get<int>("parameter2");
        var parameter3 = handlerParameters.Get<string[]>("parameter3");

        // Do your thing with these parameters and contruct and return your stream

        return new StreamResult(stream);
    }
}
documentViewer.DocumentHandlerType = typeof(MultiParameterDocumentHandler);

// When you need to pass custom parameters along with the input file to your handler implementation,
// use documentViewer.DocumentHandlerParameters property to set your parameters.
// These will be passed to the methods of your handler implementation:
documentViewer.DocumentHandlerParameters.Set("parameter1", "some string");
documentViewer.DocumentHandlerParameters.Set("parameter2", 45);
documentViewer.DocumentHandlerParameters.Set("parameter3", new[] { "a", "b", "c" });

documentViewer.Document = "InputFile.docx";
See Also