0

I'm working with html2canvas for a project. I dynamically build some images for some kind of products and then I use html2canvas to save them. This works fine on my local server, but when I submitted everything in production, the code didn't work. I'm going to show you the code before telling what happens in production.

$('.open-img-builder').click(function() {
var att = $(this);
$('#image_builder').dialog({
  autoOpen: true,
  modal: true,
  width: 1000,
  height: 600,
  title: 'Build Image',
  buttons: {
    'Cancel': function(){
      $(this).dialog('close');
    },
    'Confirm': function(){

     html2canvas(document.getElementById('image-live')).then(function(canvas) { 
            #code here
           });
        });
      });

    }
   }
 });
  #here goes the open and close function but they're not linked with the problem
});

I show the image that will be saved in the dialog and when the user presses Confirm, the image should be saved, but it's not what happens.
The only thing that happens is that the dialog will duplicate each time the user presses confirm.
Does anybody have the same issue and found an answer?

UPDATE1: I just tryied to put an "alert" right after the "then(function()" and nothing happens so i don't think that the problems is that one

UPDATE2: I tried to take a "screenshot" with html2canvas on another random element oh the document and... it worked on everything but not where i need it to work...

UPDATE3: i Just saw something. When i click the 'Confirm' button, an iframe appears in the document.

<iframe class="html2canvas-container" scrolling="no" data-html2canvas-ignore="true" style="visibility: hidden; position: fixed; left: -100000px; top: 0px; border: 0px none;" width="1408" height="640"></iframe>
A.lberto
  • 1
  • 2
  • Look on local where the plugin saves the file and make sure the corresponding folder on remote server has writing permissions. – tao Sep 20 '18 at 14:01
  • I just tryied to put an "alert" right after the "then(function()" and nothing happens so i don't think that the problems is that one – A.lberto Sep 20 '18 at 14:08
  • Did you ever figure out the problem? I'm having the same issue. – nyphur Mar 11 '20 at 18:32

0 Answers0