jSignature icon indicating copy to clipboard operation
jSignature copied to clipboard

Importing Data to a different sized jSignature

Open JasonA86 opened this issue 8 years ago • 5 comments

I am having a problem importing data to a jSignature where the jSignature is a different size from when the signature was saved.

The jSignature on my app is variable sized based on the width of the screen (and thus landscape/portrait). The problem I am having is if someone: -signs the pad in landscape mode. -Goes to another screen. switches to portrait mode -Then returns to the previous page.

In this case the signature changes. It gets shifted because the signature pad is a different size.

I am exporting the signature in base30.

Do you know how to fix this problem?

JasonA86 avatar Mar 28 '16 14:03 JasonA86

Nevermind. Now I see that this has already been reported: https://github.com/brinley/jSignature/issues/67

Does anyone have a workaround?

JasonA86 avatar Mar 28 '16 14:03 JasonA86

How would you envision this to work? Do you have the signature canvas with the same aspect ratio?

brinley avatar Jul 07 '16 08:07 brinley

Hello @brinley, I have similar problem. Yes, I think the only way would be to keep aspect ratio. That is something I already do, but transferring signature between devices with different screen sizes/or resizing on device where it is possible still brakes it.

I think some calculations on you native format would be necessary before it can be used, but I am not at home in your code too much nor I have any experience with image processing, canvas etc.

Thanks

durasj avatar Aug 03 '16 14:08 durasj

Hey @durasj,

I dont believe the solution would require any reprocessing of the image data if aspect ratio is kept. I suspect it would be as simple as modifying getPointFromEvent to check the current scale of the image and adjust the coordinates of to the original image. I dont have time to look into this at the moment. Are you able to have a look at this section considering that you have experimented with signatures on different screen sizes?

Regards, Brinley

brinley avatar Aug 03 '16 23:08 brinley

I am no longer working on this project and haven't used the signature in a long time. I found a workaround by loading the signature as an image. so, they can never edit their old signature. only view it and then possibly delete and re-sign.

But to solve this problem I think you'd have to store the height and width of the signature. then, when you're loading it, first load it at the original size and then re-size it to fit the screen.

JasonA86 avatar Aug 03 '16 23:08 JasonA86