Accessing Signature Saved in Device (React Native)

Product: react-native-pdftron

Product Version: Legacy UI (as in Github)

Please give a brief summary of your issue:
How to access signature saved in device

Hello, I have some question with react-native-pdftron.
How can I access the saved signature in device? And for account management, sometimes we do not want certain user to see the saved signature in the same device (let say if a same device (android/ios) is used by 2 person that have their own account). Is it possible to save or load the signature elsewhere? (Maybe like in databases or phone secure async storage with unique name (expo))
Thank you very much.

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hi,

We have an API for showing saved signatures, if this is set to false you should not see any saved signatures.
Please see here for more info: showSavedSignatures

Could you describe your use case for this?

Best Reagrds,
Eamon

I’d like to show (load) the saved signature based on the user who is using the app (by signing in first before using the app). So I would like to know if there are ways to save the signature somewhere else (like in secure async storage with custom defined storage name).
Thank you.

Hi,

We are working on a new API that will be added to React Native to return saved signatures.
We will update you as soon as possible.

Best Regards,
Saeed

1 Like

Hi, please find the APIs you are looking for here: (Support) getSavedSignatures, getSavedSignatureFolder by akwanpdf · Pull Request #371 · PDFTron/pdftron-react-na. What you want to do is upload those signatures to your server, remove them from the folder (using regular storage API), then put back the ones you want to show in the folder whenever appropriate. Could you please give it a try? Thanks.

1 Like

Hello!

I already updated the library.
But I don’t know how I suppose to use the new added function (getSavedSignatures).
I tried to call the function via DocumentView ref (like viewer.current.getSavedSignatures()) but it won’t work.
Maybe can I get an example of how to use it?

Thank you very much.

=====================
Edit: This is how I used it.

//Top of code
const viewer = useRef()
useEffect(() => {
RNPdftron.initialize("")
}, [])
//The document view component call
<DocumentView
ref={viewer}
document={pdfFile}
isBase64String={true}
onDocumentLoaded={() => {
viewer.current.getSavedSignatures().then((sig) => console.log(sig))
}}
/>

===================
I get an error “TypeError: DocumentViewManager.getSavedSignatures is not a function. (In ‘DocumentViewManager.getSavedSignatures(tag)’, ‘DocumentViewManager.getSavedSignatures’ is undefined)”.

Could you please double check that you’ve updated to the latest version “2.0.3-beta.176”? “is not a function” likely means your version is not up to date. Thanks.

This is how I upgrade the package.
“yarn add github:PDFTron/pdftron-react-native”
and this what I get.

success Saved 1 new dependency.
info Direct dependencies
└─ react-native-pdftron@2.0.3-beta.177
info All dependencies
└─ react-native-pdftron@2.0.3-beta.177

============================
I also tried “yarn upgrade github:PDFTron/pdftron-react-native”

But the result still the same.
The function is already in DocumentView.js file.
image

On our end, we are getting the correct result:

Could you please upload a sample project so we can reproduce what you see on our end?
Thanks.

Hello,

Thank you for your responses.

Apparently I just need to re-install and rebuild the debug app again via “react-native run-android” then “react-native start”. Because before I just run the project via “react-native start” and then connect my phone with same WiFi and then use the “old” debug app to connect through my PC react native address to do some debugging and develop my application. Now the new function is working just fine as how it should be.

Again, thank you very much.