Opening signature picker

Product: PDFTron Android SDK

Product Version: 9.2.1

Please give a brief summary of your issue:

I would like to open the signature picker immediately instead of having the bottom tool with the most recent signature in it, because I have to replace this dialog with a dialog of my own for importing a custom signature from a hardware device.

Is there any way to replace the signature picker when the custom PTDigitalSignatureTool is enabled? Or is there any way to instantly trigger the signature picker dialog?

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:

@simon.brunou thanks for your feedback. We’ll look into the options and update you with more information as soon as we can. Thanks.

@simon.brunou Are you using the signature preset area? Or are you customizing that too? Do you mind send us an expected flow mockup so we can better suggest? Thanks.

I will eventually be customising the signature picker dialog for communicating with our device, but I would first like to display the signature picker in fullscreen when tapping the screen with the tool selected, without displaying the small signature at the bottom of the screen.

Basically, I would like to get rid of this bottom preview and trigger the signature dialog when tapping the screen.
I already implemented this functionality in Android.
However, since the library is working differently in iOS, I could not juste adapt the code in Swift and roll with it.

@simon.brunou I think there is some confusion. It looks like you reported this ticket as Android but you are actually looking to do this functionality in iOS? The screenshot shown is iOS and you mentioned “PTDigitalSignatureTool”. Is that correct?

In any case I will forward you to our iOS team, if you actually have an Android question, please kindly submit another ticket for Android. Thanks.

Hi, yes my problem is iOS related.

Hi Simon,

To hide the bottom preset area, you could subclass PTDigitalSignatureTool and return false for canEditStyle method.

We are working on a solution for you to trigger the signature dialog when tapping the screen. What is your expected behaviour for iPad? Are you customizing a fullscreen dialog for iPad too? The signature list is shown in a pop-up style on iPad in current version so it works differently from iPhone.

Best,
Yifan

Hi,

thank you for your answer about hiding the bottom preset area, it behaves like I want it to.

Ideally, I would like to have a full screen dialog for iPad too, but the priority is customising the signature dialog so it can wait, or I can figure it out by myself.

Hi Simon,

Thank you for the feedback.

We have added support for showing the signature list when tapping in this build:
https://pdftron.s3.amazonaws.com/custom/ID-zJWLuhTffd3c/brunou/2022-04-21/PDFNet_iOS-2022-04-21-162857.dmg
Are you able to try it and see if this works for your case?

You could set the option to always show the signature list when tapping:

toolManager.signatureAnnotationOptions.showSignatureListWhenTapped = YES;

To show the signature list in full screen, in your PTDigitalSignatureTool subclass, add:

- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller traitCollection:(nonnull UITraitCollection *)traitCollection {
    return UIModalPresentationFullScreen;
}

And you could override PTSavedSignaturesViewController to customize your signature dialog.

Please let us know if you have more questions.

Thank you,
Yifan

Hi,
the fullscreen modal behaves like expected, thank you!
Now I can get back to my original question: I would like to override the dialog shown when picking a signature. Here is an android example:

class ImprintTool(ctrl: PDFViewCtrl) : Signature(ctrl) {
    companion object {
        val MODE: ToolManager.ToolModeBase = ToolManager.ToolMode.addNewMode(Annot.e_Widget)
    }

    override fun getToolMode(): ToolManager.ToolModeBase = MODE

    override fun createSignatureDialogFragment(
        targetWidget: Long?,
        toolManager: ToolManager?
    ): SignatureDialogFragment = ImprintDialogFragment()

    override fun createSignatureDialogFragment(
        targetWidget: Long?,
        toolManager: ToolManager?,
        dialogMode: SignatureDialogFragment.DialogMode?
    ): SignatureDialogFragment = ImprintDialogFragment()
}

The class ImprintDialogFragment extends SignatureDialogFragment.

I would like to achieve the same behaviour but in Swift. Do you know what method I should call to replace the dialog by our own dialog?

Thanks.

Hi Simon,

We are glad to see the fullscreen working.

Sorry we don’t have similar methods to replace the dialog on iOS. PTSavedSignaturesViewController is a subclass of UITableViewController that shows the list of saved signatures. You might need to subclass PTSavedSignaturesViewController and customize its cells (cellForRow(at indexPath: [IndexPath])) and style by overriding methods of UITableViewController .

Please let us know if this works.

Thank you,
Yifan

Since we can’t do the same as Android, is there a way to override the onTap method that you use when we click on a document?
Or a way to override the signature list that is shown when we click somewhere on a document?
I managed to override the showSignatureList of PTDigitalSignatureTool but it won’t work since i can’t change the delegate of my class that extends PTDigitalSignatureTool.

Hi Simon,

Thank you for getting back to us with more information.

Just to make sure, is this the whole flow of your expected behaviour: click somewhere on the document, the customized signature list will be presented in fullscreen, choose a signature and it signs where you click?

Do you subclass PTSavedSignaturesViewController or you want to present your own signature list in showSignatureList?

Overriding the onTap method can be achieved by subclassing PTDocumentController and implementing this method:
- (BOOL)toolManager:(PTToolManager *)toolManager handleTap:(UITapGestureRecognizer *)gestureRecognizer

Thank you,
Yifan

The flow expected is : click somewhere on the document, a custom screen is presented (not a list of signature or anything, just another view), from this view we can select a custom “signature” and it adds the “signature” where we click.
I already have a PTDigitalSignatureTool subclass where there’s apparently a showSignature method that can be override but I can’t seem to be able to make it work.

Hi Simon,

Thank you for providing more information.

One way to achieve this functionality is to override showSignatureList, and have a callback method to add the signature after selection:

- (void)showSignatureList {
    [self.toolManager.viewController presentViewController:<your customized view controller> animated:YES completion:nil];
}

- (void)yourCallbackMethodToAddSignatureDocAfterSelection:(PTPDFDoc *)theSelectedSignatureDoc {
    // you could set a delegate of your customized view controller to call this method after selection
    [self addStamp:theSelectedSignatureDoc];

Please let us know if you have more questions.

Best,
Yifan