User Interface
To the Camera UI, you can add as many text and graphic elements as needed.
Usage
Use the uiCustomizationLayer
property:
DocumentReader.Instance().Customization().Edit().SetUiCustomizationLayer((Org.Json.JSONObject)"{ \"objects\": [ { \"label\": { \"text\": \"Place the document\\ninside the camera frame\", \"position\": { \"h\": 1.0, \"v\": 1.0 }, \"background\": \"#00FFFFFF\", \"fontColor\": \"#FFEB6517\", \"fontSize\": 18, \"alignment\": \"center\" } } ] }").Apply();
var jsonString = "{ \"objects\": [ { \"label\": { \"text\": \"Place the document\\ninside the camera frame\", \"position\": { \"h\": 1.0, \"v\": 1.0 }, \"background\": \"#00FFFFFF\", \"fontColor\": \"#FFEB6517\", \"fontSize\": 18, \"alignment\": \"center\" } } ] }";
NSError err;
NSData data = NSData.FromString(jsonString);
NSDictionary json = (NSDictionary)NSJsonSerialization.Deserialize(data, NSJsonReadingOptions.MutableContainers, out err);
RGLDocReader.Shared.Customization.CustomUILayerJSON = json;
Examples
JSON Structure
The JSON with all possible params can be found here.
objects
└── label
└── image
Name | Description |
---|---|
label |
Text elements |
image |
Graphic elements |
Label
Adds text elements to the UI.
label
└── text
└── fontStyle
└── fontColor
└── fontSize
└── fontName
└── alignment
└── background
└── borderRadius
└── padding
| └── start
| └── end
| └── top
| └── bottom
└── margin
| └── start
| └── end
| └── top
| └── bottom
└── size
| └── width
| └── height
└── position
| └── h
| └── v
Name | Description |
---|---|
text |
Text |
fontStyle |
Defines whether a font should be styled with a normal, italic, or bold face. Possible values:
|
fontColor |
Font color, hex |
fontSize |
Font size, dp - Android, pt - iOS |
fontName |
Font name |
alignment |
Defines how text aligns in the space it appears:
|
background |
Background color, hex |
borderRadius |
Defines the radius of the element's corners, lets you add rounded corners to elements |
padding |
The space between an element's border and the element's content |
margin |
The space around an element's border |
size |
Size:
|
position |
Position:
The value should be in a range from 0 to 2 |
Warning
If both position
and margin
are used, position
has the priority.
Image
Adds graphic elements to the UI.
image
└── data
└── name
└── background
└── borderRadius
└── contentMode
└── padding
| └── start
| └── end
| └── left
| └── right
| └── top
| └── bottom
└── margin
| └── start
| └── end
| └── top
| └── bottom
└── size
| └── width
| └── height
└── position
| └── h
| └── v
Name | Description |
---|---|
data |
Image in the Base64 format |
name |
File name (for Android: the file is taken from the drawable folder) |
background |
Background color, hex |
borderRadius |
Defines the radius of the element's corners, lets you add rounded corners to elements |
contentMode |
Defines how a view adjusts its content when its size changes:
|
padding |
The space between an element's border and the element's content |
margin |
The space around an element's border |
size |
Size:
|
position |
Position:
The value should be in a range from 0 to 2 |