Product used: React Native PDFTron 2.0.3-beta.177
I have managed to try using getSavedSignatures and getSavedSignatureFolder function for my use cases that I have described in this thread https://community.pdftron.com/t/accessing-signature-saved-in-device-react-native/4403. However, there are some issues that I got. The thumbnail that appeared in the signature browser shows the wrong preview of the signature. Is there any way to delete the thumbnail cache so that the signature preview that will be shown is correct?
This is the signature browser:
This is the actual signature (the second signature in the signature browser):
Also, why does the button that used to add new signature at signature browser doesn’t show any text at all (just like in my first screenshots)? Is there any way to show a text like “create new signature”? And just want to know is there any possible way to hide that “add new signature button”?
Thank you very much.
Could you describe to us exactly how you are currently using the getSavedSignatureFolder and getSavedSignatures API? How are you are you deleting and replacing the saved signatures?
As for the add new signature button, this seems to be a bug on our end and I’ll have to take a closer look. Also it’s not possible to hide this button. Could you describe the use case and why you would like to hide this button in your app?
Just to follow up. The missing text in the button has been fixed in the latest version of the PDFTron React Native library.
Also, as for the issue where thumbnail preview is incorrect, you will need to also delete the folder that contains the cached signature images at getSavedSignatureJpgFolder API whenever the user changes in your app.
I have managed to delete all of the JPG thumbnail cache and now when new signature copied from DB, it’s showing the right thumbnail. And the button now has label “CREATE NEW SIGNATURE”.
About hiding the “CREATE NEW SIGNATURE” button,
I want that maybe if user can only have 1 signature. So if there is signature exists in the directory, I want to hide the button so that if user already has saved signature, they cannot create more signature.
Maybe something like this:
const signatureExists = await viewer.current.getSavedSignatures()
//default to false
signatureExists.length > 0 ? true : false
Currently it’s not possible to show/hide the create new signature button programmatically. However, we do support some API that hides saved signature here: https://github.com/PDFTron/pdftron-react-native/blob/master/API.md#showsavedsignatures
Would this be a viable alternative for you?