1

I need to persist the value of p:signature in Oracle. I'm using the String value (JSON lines) of the component but often users get too elaborate with their cursive signature and the string exceeds the 4000 character limit on the Oracle field. I implemented a validator to ensure 4k or less but users get frustrated when form kicks back and they have to retry.

Is there a way to minify the json representation of the line data generated but still have the signature still visually look the same? Like a curve fitting function. If I simply truncate the string to 4k, that just truncates the end of the signature.

It would be nice if the component had a way to set precision of the curve or max flag that would automatically keep the JSON representation to less a maximum number of characters.

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
jeff
  • 3,618
  • 9
  • 48
  • 101

1 Answers1

1

You are trying to hammer a square peg in a round hole. A signature is as big as it is. Even if you compress it, it's never guaranteed to be less than 4k. You should use the correct column type for your data. In this case either a CLOB (or a BLOB).

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
  • wasn't looking to "compress" the string data but remove some of the detail with a curve fit. If I were able to drag the mouse left to right perfectly straight and horizontally I assume the JSON data would be the X,Y of the left starting point and the X,Y of the right ending point. This would be a much shorter string than doing the same but having a slight jittery hand where the JSON data would be the X,Y of the left starting point and the X,Y of the right ending point but also a bunch of interior points where the Y value varied slightly. Both strings basically represented a horizontal line. – jeff Feb 10 '23 at 12:08
  • See also https://stackoverflow.com/questions/42762362/how-to-convert-psignature-value-to-an-image-or-other-serialised-form – Jasper de Vries Feb 10 '23 at 12:56
  • That could also be considered as a form of compression. Either way, you cannot guarantee let than 4k chars. – Jasper de Vries Feb 10 '23 at 13:19
  • I don't see why you couldn't. You could fit a curve on top of the original data that uses some algorithm such that the new string length never exceeds 4k. Sure if may have lost so much clarity that it doesn't look like the original. The same way you can reduce the resolution of an image so the file size is below a desired value. – jeff Feb 10 '23 at 13:46
  • I can just keep adding curves of some algorithm which are reduced to some size until they exceed 4k. Image resolution is totally different. – Jasper de Vries Feb 10 '23 at 13:58