How to store stylus data such as pressure and velocity?

, , ,

Question:

We are using a stylus to create handwritten signatures, and we would like to save the biometric information (pressure, speed…) within the PDF.

The PDF standard allows the storage of this data, but I am currently struggling how to do this with PDFNet internal methods.

Answer:

Since there is no specific support for recording pressure, speed, etc. of a pen, just the points, then you would be adding custom data.

See this section for how to add custom data to a SDF object.
https://www.pdftron.com/documentation/core/guides/low-level-api#sdfobj

So in your case, you would be adding this custom data to the Annotation or Field object. In particular you would add a sibling Dictionary object to store your data.

Obj annot_obj = annot.GetSDFObj(); Obj metrics_obj = annot_obj.PutDict("BioMetrics"); Obj velocity = metrics_obj.PutArray("Velocity"); velocity.PushBack(value);