2017-03-14 6 views
1

나는 wkhtmltoimage을 사용하고 있습니다. 예를 들어 잘 작동합니다. http://stackoverflow.comAngularJs 웹 사이트의 이미지를 렌더링하는 방법은 무엇입니까?

하지만 AngularJS와 어떤 웹 사이트에서 실행하려고하면 (예를 들어 https://material.angularjs.org/latest/) :

wkhtmltoimage.exe --no-stop-slow-scripts --javascript-delay 5000 --enable-javascript --debug-javascript https://material.angularjs.org/latest/ C:\\dev\\temp\\0c8fca2c-0990-40c4-8672-12fc71ec6cf6.png 

A (덕분에 : --debug-javascript 플래그) 오류 JS 오류가

Loading page (1/2) 
Warning: undefined:0 Error: [$injector:modulerr] http://errors.angularjs.org/1.5.5/$injector/modulerr?p0=ng&p1='undefined'%20is%20not%20an%20object 
Rendering (2/2) 

결과 이미지는 단지 작은 흰색 줄무늬입니다. 당신이 작동하는지 확인하기 위해 "polyfill"를 제공해야하므로

+0

브라우저에서 열면 페이지가 정상적으로 렌더링됩니까? 그렇지 않으면 오류가 발생합니까? - 오, 무슨 각도 야? –

+0

@ 곤잘로 .- 물론. 이 페이지는 내가 사용하고있는 부속 명령에 포함되었습니다 (각도 재료의 홈 페이지). – gisek

답변

2

그것은 Function.prototype.bind 멋지게 연주하지 않고 wkhtmltopdf 보인다 르네 방법

은 (> = 1.5 각도에 사용).

Function.prototype.bind = function(oThis) { 
    if (typeof this !== 'function') { 
     throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); 
    } 

    var aArgs = Array.prototype.slice.call(arguments, 1), 
     fToBind = this, 
     fNOP = function() {}, 
     fBound = function() { 
      return fToBind.apply(this instanceof fNOP 
       ? this 
       : oThis, 
       aArgs.concat(Array.prototype.slice.call(arguments))); 
     }; 

    if (this.prototype) { 
     fNOP.prototype = this.prototype; 
    } 

    fBound.prototype = new fNOP(); 

    return fBound; 
}; 
+0

이 코드는 어디에서 언급해야합니까? 시도했지만 여전히 작동하지 않습니다. – Mahajan344

+0

앱에 포함 된 * .js 파일에 추가해야합니다. – vitozev