«1

Posts

  • RobNugentRobNugent GBMember

    Hi Alan,

    I am now porting my prototype to start using your

    Acr.XamForms.Mobile
    Acr.XamForms.SignaturePad
    Acr.XamForms.UserDialogs

    PCLs

    I am adopting your MVVM framework - so using Autofac as you do in my app.cs file etc...

    All has gone well so far and I have a clean compile.

    However none of my events are firing.
    My assumption is that I have something wrong with my naming conventions or locations for my views and viewmodels that is causing the classes to not register correctly.d

    I have followed your samples project structure as closely as I can - so have additional namespaces for Views and ViewModels.

    Can you advise the best way to debug View / ViewModel registration process that you use?

    Kind regards

    Rob

  • AllanRitchie-oldAllanRitchie-old CAInsider ✭✭✭

    I'd rather not hijack this thread for questions outside of the signature pad. Please file stuff like this on github in the future.

    For the current issue you are having with view resolution, it wouldn't block events as it has nothing to do with anything. If the view is being displayed then the stuff my library does is done.

  • RobNugentRobNugent GBMember

    Sure Alan.
    Apologies for posting here.

    Rob

  • syedaliazizsyedaliaziz USMember ✭✭

    Hi Allan,

    I have tried using signature pad, really appreciate all the efforts you put in there but I am facing few issues while using it:

    • I tried running it on android emulator when i sign and click save button, it saves with 0Kb file size and when I try to open that saved signature image it just hangs with black screen (not shows anything).
    • No support for windows phone 8.1?

    Please help.

  • AllanRitchie-oldAllanRitchie-old CAInsider ✭✭✭

    Hi Syed

    Since this control doesn't actually save anything directly, it is very likely something with your code. If you are using GetImage, you have to copy that stream into a filestream of your own.

    Windows 8.1 could be added. I just don't have a need for it at the moment, so I haven't done it. My code is only a wrapper around xamarin's pretty signature pad anyhow. It should be easy enough to add if you want to submit a PR on github.

  • David.6954David.6954 USUniversity ✭✭
    edited October 2014

    To all,

    I too have tried using the signature pad and am running into the same 0Kb file issue. Hopefully it is just something I messed up on my end. Here is a sample of the code I am using to create the image file:

    private void ReadWriteStream(Stream readStream, Stream writeStream)

    {

    int Length = (int)readStream.Length;
    
    Byte[] buffer = new Byte[Length];
    
    int bytesRead = readStream.Read(buffer, 0, Length);
    
    while (bytesRead > 0)
    
    {
    
        writeStream.Write(buffer, 0, bytesRead);
    
        bytesRead = readStream.Read(buffer, 0, Length);
    
    }
    
    readStream.Close();
    
    writeStream.Close();
    

    }

    void OnButtonClicked(object sender, EventArgs e) //Save button action

    {

    List<DrawPoint> signaturePoints = signaturePad.GetDrawPoints ().ToList();
    
    if (signaturePoints.Count > 0) {
    
        var docFolder = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal);
    
        Console.WriteLine ("Data path:" + AssetTrackingDatabase.DatabasePath);
    
        var signatureFile = Path.Combine (docFolder, "test.jpg");
    
        using (var ms = new MemoryStream ()) {
    
        }
    
        Stream readStream = signaturePad.GetImage (ImageFormatType.Jpg);  // Default database data
    
        FileStream writeStream = new FileStream (signatureFile, FileMode.OpenOrCreate, FileAccess.Write);
    
        ReadWriteStream (readStream, writeStream);
    
    }
    

    }

    Side note issue: Is there some reason why the SignaturePadView won't work on Scrollview pages on android? Currently, when I try to place a SignaturePadView in a scrollview it will only draw a tiny line per stroke before stopping altogether.

    Thanks for all your work you have done so far on the signature pad!

  • jr.4127jr.4127 FRMember ✭✭

    Same issue here, can't find a way to same the GetImage() result, the stream is always empty, resulting in an empty file.

    using (var fileStream = new FileStream(_path, FileMode.OpenOrCreate, FileAccess.Write)) stream.CopyTo(fileStream);

    Any idea / fix from the developers ?

  • jr.4127jr.4127 FRMember ✭✭

    Ok i get it, noob issue indeed... just need to set the stream to the beginning.

    using (var fileStream = new FileStream(_path, FileMode.OpenOrCreate, FileAccess.Write)) { stream.Position = 0; stream.CopyTo(fileStream); }

  • AllanRitchie-oldAllanRitchie-old CAInsider ✭✭✭

    I'll set the position to 0 automatically in the next release.

  • Andrew.4149Andrew.4149 USMember

    How to do you make it save as non-transparent image. I'm using crystal reports and it's showing with black background because it's transparent. I see there is option for SetAlpha() which I think deals with transparency but tried commenting out and saving with various values and still same thing.

  • Andrew.4149Andrew.4149 USMember

    I thought it was transparency problem because images were showing up with black background in Crystal Reports. But then I saved image to SD card and realized they had a black background with jpegs which don't support transparency. Then I found the real problem. I didn't set the stroke and fill color. See below.

    signature.GetImage(Color.Black, Color.White)

  • BrianRepettiBrianRepetti USUniversity ✭✭✭

    I am trying to use this on WinPhone but it appears the NuGet package is missing an assembly for WinPhone?

    I tried downloading the source code but I can't get it to build.

    Anybody have any luck with this on WinPhone?

  • AllanRitchie-oldAllanRitchie-old CAInsider ✭✭✭

    I never finished the winphone implementation. I'll take a PR if anyone is interested.

  • FahimFahim AUMember, University
    edited March 2015

    Are there any samples on how to save and retrieve signatures using Xamarin Forms in XAML for 'ACR Signature Control'.

  • RajanJohnRajanJohn USMember

    I am trying to display the signature in Xamarin.Forms Image control. I am calling GetImage method from the signature control and convert this to Stream. in png format it works fine. but Jpeg format is not working at all. I see the same behavior both in Android and windows platform. Any suggestion on how to make it work for Jpeg formats well?

  • AllanRitchie-oldAllanRitchie-old CAInsider ✭✭✭

    Rollback the stream to position 0. Just as an FYI, I'm not maintaining the control version of the signature pad because of numerous issues and changes going on with the internal of xamarin forms right now. You are better to use the service.

  • RajanJohnRajanJohn USMember

    Thanks for your reply Allan. Setting the stream position to 0 didn't help. For me the signature pad control seems to be working fine with Xamarin Forms but the Jpeg format stream is not working

  • AllanRitchie-oldAllanRitchie-old CAInsider ✭✭✭

    @RajanJohn This library has never supported windows and isn't part of the nuget package. I also don't see any issue with the jpg conversion code. If you are sure there is an issue, please review the code on github and file an issue with a full test case or a fix.

  • BrianRepettiBrianRepetti USUniversity ✭✭✭

    Maybe its what you are doing with the stream? I don't have any issues with Allan's library.

    I had to write my own implementation for WinPhone. If I recall I could not find the PNG Compression option in WinPhone. Only JPEG was supported.

  • QAcGQAcG MXMember
    edited June 2015

    hi I am trying to implement this in my Xamarin Forms project, I use the following code:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Xamarin.Forms;
    using Acr.XamForms.SignaturePad;
    
    namespace Schedule.Pages
    {
        class Page_Schedule_UsuarioDetalle_Signature : ContentPage
        {
            public StackLayout SL_root;
            public SignaturePadView signaturePad;
    
            public Page_Schedule_UsuarioDetalle_Signature()
            {
                BuildScreen();
            }
    
            void BuildScreen() {
                SL_root = new StackLayout() {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    Orientation = StackOrientation.Vertical
                };
    
                AddSignaturePadLayout(SL_root);
    
                this.Content = new ScrollView {
                    Content = SL_root
                };
            }
    
            void AddSignaturePadLayout(StackLayout root) {
                signaturePad = new SignaturePadView()
                {
                    HeightRequest = 320,
                    WidthRequest = 240,
                    BackgroundColor = Color.Yellow,
                    CaptionText = "Caption this",
                    CaptionTextColor = Color.Black,
                    ClearText = "Clear!",
                    ClearTextColor = Color.Red,
                    SignatureLineColor = Color.Black,
                    StrokeColor = Color.Aqua,
                    StrokeWidth = 2
                };
    
                SignaturePadConfiguration aaas = new SignaturePadConfiguration() {
                    SaveText = "Salvame"
                };
                Button saveButton = new Button
                {
                    Text = "Save"
                };
                root.Children.Add(signaturePad);
                root.Children.Add(saveButton);
            }
        }
    }
    

    However it only shows the yellow square and I don't see any drawing neither the Caption Text neither the ClearText.
    What I am doing wrong ? Or what I am missing ?

  • QAcGQAcG MXMember

    @AllanRitchie can you please help me with my code? Thanks!

  • AllanRitchie-oldAllanRitchie-old CAInsider ✭✭✭

    @QAcG It likely has to do with the tabpage. The signature pad doesn't play nice with many layouts.

  • QAcGQAcG MXMember

    Ohh !!! I see... :/ So any suggestion on how to implement this? Popover, new page, what is the recommended setup for this tool ?

  • AllanRitchie-oldAllanRitchie-old CAInsider ✭✭✭

    The less layout you have around it, the better of you are. The signature pad really wants to grab the entire screen.

  • QAcGQAcG MXMember

    Ok, I'll give it a try and will let you know. Thanks buddy!

  • QAcGQAcG MXMember

    @AllanRitchie I did what you suggested and still no luck :(

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Xamarin.Forms;
    using Acr.XamForms.SignaturePad;
    
    namespace Schedule.Pages
    {
        class Page_Schedule_UsuarioDetalle_Signature : ContentPage
        {
            public Page_Schedule_UsuarioDetalle_Signature()
            {
                StackLayout SL_root = new StackLayout()
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    Orientation = StackOrientation.Vertical
                };
    
                SignaturePadView signaturePad = new SignaturePadView()
                {
                    HeightRequest = 320,
                    WidthRequest = 240,
                    BackgroundColor = Color.White,
                    CaptionText = "Caption this",
                    CaptionTextColor = Color.Black,
                    ClearText = "Clear!",
                    ClearTextColor = Color.Red,
                    SignatureLineColor = Color.Black,
                    StrokeColor = Color.Aqua,
                    StrokeWidth = 2
                };
                SL_root.Children.Add(signaturePad);
                this.Content = SL_root;
            }
        }
    }
    

    I call this page using_

    await this.navigation.PushModalAsync(new Page_Schedule_UsuarioDetalle_Signature());
    
  • Billy12ShovelsBilly12Shovels USUniversity ✭✭✭

    Has anyone made the WP implementation for this and would be able/willing to share?

    Thanks!

  • ChrisDrewChrisDrew GBMember ✭✭

    Like the idea of the control but i want to use it in a larger form which is in a scroll view - anyway to get SignaturePad to work with a scrollview as currently as above it just draws a line and stops?

  • QAcGQAcG MXMember

    @AllanRitchie Do I need to implement something else or create other classes or methods to make it work? Does it work out of the box?

  • PeterTabattPeterTabatt USMember ✭✭

    Is there some way for me to superimpose text on the signature pad and when calling GetImage() to get an Image of the signature with the superimposed text? It's kind of nice to get a copy of not just a person's signature but also what they're signing.

  • KentBoogaartKentBoogaart AUMember ✭✭

    @QAcG: I had the same problem symptoms as you. Be sure to install the NuGet in both your PCL and your host native project.

  • KentBoogaartKentBoogaart AUMember ✭✭
    edited September 2015

    Of all the components not to provide change notification (specifically, when the signature is modified), this would have to be the most in need. It's not really to poll because of how expensive it is to do so. Thus, if one requires a signature before the user can continue, the only option is to throw up an alert. Not ideal.

    @AllanRitchie : Any chance change notification could be added?

  • AllanRitchie-oldAllanRitchie-old CAInsider ✭✭✭

    I would take a PR for it, but I have no plans to add it because I don't really believe in the use-case. Changing a signature doesn't make a lot of sense to me. You can use IsBlank to ensure that a signature has been supplied.

  • KentBoogaartKentBoogaart AUMember ✭✭

    @AllanRitchie: fair enough, but I think you've missed the point of the use case.

    A screen that requires the user sign before moving to the next can't disable the NEXT button until a signature is provided because it has no notification of the signature changing. It would have to poll the IsBlank property, which is a trade off between battery consumption and correctness (because polling allows for a small period of time between the user clearing a signature and the button becoming disabled again. Conceivably the user could clear and very quickly click the NEXT button before the polling logic kicks in).

  • Is there a way for the points to be less precise. We are working on an existing app that provides an array of integers for the points rather than an array of floating points. If the signature was less precise the push of the points back through an existing webservice (that we cant change) would require a smaller XML payload.

  • Another question about the Points. We handed over the points to the server based process. When the website drew the image it appears that every time the signer lifter finger off the signature pad and started again would result in the points returning to 0,0. Then a line would draw from 0,0 to the start of the next letter being written.

    How should another process treat the points. Are they instructions to write from 1 point to the next or are they just dots to be placed on an image?

  • Johan_SchoemanJohan_Schoeman ZAMember ✭✭

    @AllanRitchie: Can you push a build that will work with Forms 2.0? I tried building it (https://www.nuget.org/packages/Acr.XamForms.SignaturePad/2.0.5) my self but cannot get it right.

  • jr.4127jr.4127 FRMember ✭✭

    +1 for a Forms 2 version, thanks !

  • appreciate your efforts @AllanRitchie, +1 for a Forms 2 version

  • AllanRitchieAllanRitchie CAInsider, University ✭✭✭

    Hi Guys. I won't be maintaining this component anymore. It has served its purpose for me. This is stated on the github repo, but I have left the code as is. I continue to maintain many other of the components I have, but signaturepad is not going to be one of them.

    That being said, if you could please stop tagging me in the +1's, personal messages, etc. I would be grateful.

Sign In or Register to comment.