function html2pdf(e,t,a,i,r){if(e){t=t||"file.pdf","number"!=typeof i&&(i=1),r=r||144;var o=jsPDF_getSize(a=a||{}),h={width:o.width-2*i,height:o.height-2*i};h.ratio=h.height/h.width;var d=html2pdf_makeTemplate(e,h,o),g={letterRendering:!0,dpi:r,onrendered:function(e){document.body.removeChild(d.overlay),html2pdf_makePDF(e,t,h,a,i)}};html2canvas(d.template,g)}}function html2pdf_makeTemplate(e,t,a){function i(e,t){for(var a in t)e.style[a]=t[a]}if(overlayCSS={position:"fixed",backgroundColor:"rgba(0,0,0,0.8)",zIndex:1e3,left:0,right:0,bottom:0,top:0},templateCSS={position:"absolute",backgroundColor:"white",zIndex:1001,left:0,right:0,top:0,margin:"auto",width:t.width+a.unit},overlayCSS.overflow="hidden",overlayCSS.visibility="hidden",templateCSS.zoom="200%","string"==typeof e)(r=document.createElement("div")).innerHTML=e;else var r=e.cloneNode(!0);var o=document.createElement("div");return i(o,overlayCSS),i(r,templateCSS),o.appendChild(r),document.body.appendChild(o),{overlay:o,template:r}}function html2pdf_makePDF(e,t,a,i,r){var o=new jsPDF(i),h=e.getContext("2d"),d=e.height,g=Math.floor(e.width*a.ratio),n=Math.ceil(d/g),l=h.getImageData(0,0,e.width,e.height);e.height=g;for(var p=0;ppageHeight&&(tmp=pageWidth,pageWidth=pageHeight,pageHeight=tmp);else{if("l"!==e&&"landscape"!==e)throw"Invalid orientation: "+e;e="l",pageHeight>pageWidth&&(tmp=pageWidth,pageWidth=pageHeight,pageHeight=tmp)}return{width:pageWidth,height:pageHeight,unit:t,k:k}}