sudhangi

TextAnchorPosition assignment

0 votes
Hi, I need to create a application which would allow the user to pass the text anchor position in String format. I understand that TextAnchorPOsition is of type enum. How can I set the value of '.atPosition(TextAnchorPosition.BOTTOMRIGHT)' with a stringvalue that has been passed //The code String signPosition="TOPRIGHT" mydoc.getSignatures().add(signBuild .withPositionAnchor(textAnchorBuilder .atPosition(TextAnchorPosition.BOTTOMRIGHT) //This has to be signPosition .withSize(FIELD_WIDTH, FIELD_HEIGHT) .withOffset(0, 0) .withCharacter(2) .withOccurence(k) ).build()); Thanks, Sudhangi

Approved Answer

Reply to: TextAnchorPosition assignment

0 votes
Hey Sudhangi, There isn't much you can do to change the functionality of the SDK without forking the project and making your own modification. So, the best way to do this is to do a switch statement like below, where signPosition is your string input for the position. You'd then use myanchor in your SDK code to set the position.
TextAnchorPosition myanchor;
switch(signPosition){
        case "BOTTOMRIGHT": 
                  myanchor = TextAnchorPosition.BOTTOMRIGHT;
                  break;
        ...
}
Hope this helps.

- Michael

Director, Partner and Developer Technologies, OneSpan

Facebook - Twitter - LinkedIn


Reply to: TextAnchorPosition assignment

0 votes
No worries. That would work too. Thanks, Sudhangi

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off