Skip to content

Initialization

The DocumentReader initialization works fully offline. It simply use license file, which you can get here: client.regulaforensics.com. You should add the regula.license file to your project.

public class MainActivity : DocumentReader.IDocumentReaderInitCompletion
{
    protected void initReader()
    {
        var bytes = default(byte[]);
        using (var streamReader = new StreamReader(Assets.Open("regula.license")))
        {
            using (var memstream = new MemoryStream())
            {
                streamReader.BaseStream.CopyTo(memstream);
                bytes = memstream.ToArray();
            }
        }

        DocumentReader.Instance().InitializeReader(this, bytes, this);
    }

    public void OnInitCompleted(bool success, string error)
    {
        if (success)
        {
            // initialization successful
        }
        else
        {
            // initialization was not successful
        }
    }
}
public partial class ViewController : UIViewController
{
    void InitializationReader()
    {
        // license initialization
        var licenseData = NSData.FromFile(NSBundle.MainBundle.PathForResource("regula.license", null));
        if (licenseData == null)
        {
            return;
        }
    }

    void DocReaderInitCompleted(bool successful, string error)
    {
        if (successfull)
        {
            // initialization successful
        }
        else
        {
            // initialization was not successful
        }
    }
}