-1

I am working in one project in which i have to generate Image from Division. This division is Dynamic container. Admin is adding components to that div.

I am fine to create div width of 300 X 300, see image1

Also on click of Saving this template to database before form submit i am generating image in following way.

var createContainer = document.querySelector("#container");
        html2canvas(createContainer, {
            onrendered: function (canvas) {
                console.log(canvas);
                $("#templateImage").val(canvas.toDataURL());
                console.log($("#templateImage").val());
            },
            width: 300,
            height: 300
        });

I am generating canvas of 300 X 300 using html2canvas.js

I am getting this base64 value in console but unable to get it in tax box using jqyery. the base64 value is link to file which contains base64 value

Probblem-1 I am not able to get value in textbox and to next page as well

Problem-2 I am not able to get this value in next page by POST method

Cœur
  • 37,241
  • 25
  • 195
  • 267
Chintan7027
  • 7,115
  • 8
  • 36
  • 50

1 Answers1

0

If you are able to print the value in console that means you have value in JS. You can use ajax request to send this value to server, save image on server & return the image path. Now you can set returned path on textbox OR any input fields to access the value on next page via post method.

  • Man that i know very well but i need to pass this on simple post method then?. I need solution not alternative. – Chintan7027 Mar 23 '16 at 08:55
  • Nots sure but may you are getting null values due to server side post/request length limitation OR may be due to some char in string, its not being set on textarea. – Ashish Kumar Mar 29 '16 at 07:42
  • @VinothKrishnan I had used this method in past for the same. [link](http://stackoverflow.com/questions/17672020/html2canvas-save-image-doesnt-work) – Ashish Kumar Mar 29 '16 at 07:44