I probably didn´t explained myself well since it´s a bit complicated.
The thing is that when a user clicks on a button, the document must be signed using a digital certificate but how can this be done?