Is it possibile to get .png files from signature control (for example Smooth Signature) after form submit?

  • deslab
    Asked on June 13, 2019 at 11:47 AM

    Hello,

    is it possibile to get .png files from signature control (for example Smooth Signature) after form submit?

    I read that is possibile to download file from your server by JotForm API. Is it correct?

    I work in .NET c#. If yes, how can i do it?

    Thanks.

    Regards.

  • Richie JotForm Support
    Replied on June 13, 2019 at 1:12 PM

    You may download the submission with the signature as they are sent in image format. They are also included as URLs when you export your form submissions to Excel or CSV. http://www.jotform.com/help/73-How-to-Download-Form-Submissions-to-Excel-CSV-PDF

    You may check this link regarding API download https://api.jotform.com/docs/#usecases

    For more information regarding our API kindly check this guide: https://api.jotform.com/docs/
    For API related questions you may contact our API Team at api@jotform.com.

    Hope this information helps.


  • deslab
    Replied on June 14, 2019 at 11:59 AM

    I downloaded c# api from this link https://github.com/jotform/jotform-api-csharp. There is a test project too.


    I executed test project but it raised an exception when called the getUser method: could not create SSL/TLS secure channel.

    This is the code:

    var client = new JotForm.APIClient("my-api-key");

    var user = client.getUser();

    ......


    Yestarday, I did contact api support team at api@jotform.com, but I didn't receive any answer.

  • Richie JotForm Support
    Replied on June 14, 2019 at 1:19 PM

    Can you please try adding these line of codes?

    ServicePointManager.Expect100Continue = true;
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

    Can you please move move this line: "ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;"

    Before this line:" HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);"?

    You may check this article form the internet for more information. https://stackoverflow.com/questions/32994464/could-not-create-ssl-tls-secure-channel-despite-setting-servercertificatevalida


    Please give it a try and let us know how it goes.

  • deslab
    Replied on June 17, 2019 at 2:10 PM

    It's Perfect!

    Now, I have another problem :)

    How can I download image signature of a specific submission?

    This is the code:

     

    var client = new JotForm.APIClient("API KEY");

    client.euProtected = true;

    long subID = xxxxxxxx;

    var itemSub = client.getSubmission(subID);

    var itemContent = itemSub["content"];

    var itemAnswers = itemContent["answers"];

    var answers = itemAnswers.Children();

    foreach (var ans in answers)

    {

           var token = ans.First();

           var name = token["name"].ToString();

           if (!name.StartsWith("img"))

                 continue;

           //get absolute image url

           var imgUrl = token["answer"].ToString();

     

           //download image stream

           ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

           WebRequest req = WebRequest.Create(imgUrl);

           req.Method = "GET";

           HttpWebResponse resp = (HttpWebResponse)req.GetResponse();

           .....

    }

     

    When it calls GetResponse method, it's raised an Exception like below:

    System.Net.WebException: 'Server remote error: (404) ......'    

  • Richie JotForm Support
    Replied on June 17, 2019 at 3:27 PM

    The name for getting the data from the "E-Signature" widget is "signature". However, I'm not sure if its possible using API.
    You may contact our API Team at api@jotform.com for more information.

    You may try using PHP and Post data. Please check the following guide, it gives all of the information about getting post data from your form with PHP:

    http://www.jotform.com/help/213-Send-POST-Data-From-JotForm-Using-PHP-in-Custom-Thank-You-Page


  • deslab
    Replied on June 18, 2019 at 3:41 AM

    The widget is "Smooth Signature" and this is the token content returned:

    {

      "cfname": "Smooth Signature",

      "name": "img-sign1",

      "order": "61",

      "selectedField": "529467003477f3512000001f",

      "static": "No",

      "text": "Insert signature",

      "type": "control_widget",

      "answer": "https://www.jotform.com/uploads/deslab/91614831281354/4361394383218411624/4361394383218411624_base64_114.png"

    }


    If I try to access to above URL by a new WebRequest, it raises the Exception "Server remote error: (404)".

    Should I use another widget?

    Thanks.

  • AndrewHag
    Replied on June 18, 2019 at 4:55 AM

    I am able to download the images using that link.

    1560848015ApplicationFrameHost vfwHcBI1E Screenshot 10

    Could you please go to your account settings and disable the Require login to view upload files option?

    1560848122chrome LXEfoliayr Screenshot 21

  • deslab
    Replied on June 18, 2019 at 6:04 AM

    Ok, thank you so mutch!

    Regards.