Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save whole signature field #174

Open
nuketownhf opened this issue Oct 1, 2019 · 8 comments
Open

Save whole signature field #174

nuketownhf opened this issue Oct 1, 2019 · 8 comments

Comments

@nuketownhf
Copy link

nuketownhf commented Oct 1, 2019

Hello,
currently the signature pad is saving only the drawn signature, is it possible to get the whole canvas field as a signature?

that's how it is currently:
https://i.imgur.com/5tdOjB3.png
and I want it to look like:
https://i.imgur.com/P7s2aYl.png

How can I achieve this?

thanks

@brinley
Copy link
Owner

brinley commented Oct 2, 2019

Try setting the width and height of the canvas when initialising jsignature

@nuketownhf
Copy link
Author

nuketownhf commented Oct 2, 2019

Hello,
thanks for the quick response,
if I change it to:
$(document).ready(function() {
$("#signature").jSignature({
color:"black",
lineWidth:5,
height:100,
width: 100

  });
})

it will let my CANVAS where I draw the signature smaller as seen here
https://i.imgur.com/sdrRqe0.png

but i want a margin in the signature(image) and not the canvas

@brinley
Copy link
Owner

brinley commented Oct 2, 2019

I think you might need to resize the canvas before you save. You could export the data from jsignature and import into a hidden canvas instance then resize that hidden canvas

@nuketownhf
Copy link
Author

nuketownhf commented Oct 2, 2019

Hello,
I'll try to clarify it with an image:
https://i.imgur.com/rcIP2bc.png
so basically the black box is the box where I can draw the signature
the blue box is the signature that I will get cropped exactly as seen in the image as base64-image.
But what I need is the full GREEN box as image and not the raw signature as seen in the blue box.
is this possible?
thanks

@nuketownhf
Copy link
Author

I mean somewhere in the javascript file its defined that the first pixel and the last pixel of the signature drawing should be taken

@brinley
Copy link
Owner

brinley commented Oct 2, 2019

Does having a signature line help you tell the user to sign in the middle? Otherwise there's no way other than you resizing the signature just before you export the data

@nuketownhf
Copy link
Author

by the way if I draw points at the corners the image result will look exactly how I want the image to be
https://i.imgur.com/GFFYfBc.png

regarding resizing the signature before the export, how could I do that so it looks like the image above?
thanks

@brinley
Copy link
Owner

brinley commented Oct 2, 2019

What is your use case and why do you want to save with the padding?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants