PrizmDoc Hybrid Viewing: Reduce server viewing requirements and streamline document processing
Read More
Enable your employees to remain productive throughout the document management process.
Learn how SmartZone uses a regular expression engine integrated into the recognition engine to achieve the best possible accuracy on data that can be defined by a regular expression.
The tale of how an underdog is going head-to-head with a tech giant (and winning).
I need to store a unique ID with each of my marks. Is the ID returned by Mark.GetID() unique?
Mark.GetID()
The ID generated by Mark.GetID() is only unique for that instance of the viewing session (for example, if you refresh the page, the counter for mark IDs will reset to 1).
If you are saving your marks to markup layers using the SaveMarkupLayers() method, then each mark will have a unique ID generated which will be stored in the “uid” key in the markup layer JSON.
SaveMarkupLayers()
If you are saving your marks as XML, using the SaveMarks() method, then each mark’s unique ID will be stored in the key “nodeId”.
SaveMarks()
If you want to generate your own unique ID for your marks, you can include the code below in your viewer.js to generate a UUID. A UUID contains 122 randomly generated bits so you shouldn’t need to worry about any duplicate IDs:
function uuidv4() { return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) ) }
You can store this UID in the marks data using Mark.SetData("ID", uuidv4());.
Mark.SetData("ID", uuidv4());
You can then use Mark.GetData("ID"); to retrieve the ID at a later time.
Mark.GetData("ID");