html2canvas.js use record

1. FIG be cut out of the white side

Read a lot of code, I feel a little trouble, then I had an idea directly to the canvas a little narrow, white border is not displayed directly, but this method is relatively speculation

$ ( "# Save") the Click (. function () {
             var width = $ ( 'Box.') width () -. 1;. // cut out white image side, a little less to the canvas, 
            var height = $ ( '.box') height () -. 1. ; 
            html2canvas ($ ( '.box') [0 ], { 
                width: width, 
                height: height, 
                useCORS: to true , // cross-domain image 
            }) the then (. function ( Canvas) {
                 var IMG = new new Image () 
                img.src = canvas.toDataURL ( 'Image / JPEG' ) 
                img.style.cssText= 'Position: Absolute; width: 70%; left: 15%; Top:. 4%; Z-index: 9999;' 
                $ ( '.mask2' ) .append (IMG) 
                the console.log ( "the generated image" ) 
            })

 

2. good times and bad micro letter head shots, cut out some of the text will be offset

Thought it was a picture of the cross-domain issues, engage in quite a long time, and later the Internet to see that this plugin

The layout of flex-compatible relatively poor, and it is best not to use rem set the font, and later tried it, it really is a problem flex layout

But rem of use seems to be useless what is the problem

Anyway, do not use flex layout on the right

 

 

There are other problems can take a look at the official document http://html2canvas.hertzen.com/

 

 

Guess you like

Origin www.cnblogs.com/norway/p/11950496.html