var jsPDF=(function(global){'use strict';var pdfVersion='1.3',pageFormats={'a0':[2383.94,3370.39],'a1':[1683.78,2383.94],'a2':[1190.55,1683.78],'a3':[841.89,1190.55],'a4':[595.28,841.89],'a5':[419.53,595.28],'a6':[297.64,419.53],'a7':[209.76,297.64],'a8':[147.40,209.76],'a9':[104.88,147.40],'a10':[73.70,104.88],'b0':[2834.65,4008.19],'b1':[2004.09,2834.65],'b2':[1417.32,2004.09],'b3':[1000.63,1417.32],'b4':[708.66,1000.63],'b5':[498.90,708.66],'b6':[354.33,498.90],'b7':[249.45,354.33],'b8':[175.75,249.45],'b9':[124.72,175.75],'b10':[87.87,124.72],'c0':[2599.37,3676.54],'c1':[1836.85,2599.37],'c2':[1298.27,1836.85],'c3':[918.43,1298.27],'c4':[649.13,918.43],'c5':[459.21,649.13],'c6':[323.15,459.21],'c7':[229.61,323.15],'c8':[161.57,229.61],'c9':[113.39,161.57],'c10':[79.37,113.39],'dl':[311.81,623.62],'letter':[612,792],'government-letter':[576,756],'legal':[612,1008],'junior-legal':[576,360],'ledger':[1224,792],'tabloid':[792,1224],'credit-card':[153,243]};function PubSub(context){var topics={};this.subscribe=function(topic,callback,once){if(typeof callback!=='function'){return!1} if(!topics.hasOwnProperty(topic)){topics[topic]={}} var id=Math.random().toString(35);topics[topic][id]=[callback,!!once];return id};this.unsubscribe=function(token){for(var topic in topics){if(topics[topic][token]){delete topics[topic][token];return!0}} return!1};this.publish=function(topic){if(topics.hasOwnProperty(topic)){var args=Array.prototype.slice.call(arguments,1),idr=[];for(var id in topics[topic]){var sub=topics[topic][id];try{sub[0].apply(context,args)}catch(ex){if(global.console){console.error('jsPDF PubSub Error',ex.message,ex)}} if(sub[1])idr.push(id)} if(idr.length)idr.forEach(this.unsubscribe)}}} function jsPDF(orientation,unit,format,compressPdf){var options={};if(typeof orientation==='object'){options=orientation;orientation=options.orientation;unit=options.unit||unit;format=options.format||format;compressPdf=options.compress||options.compressPdf||compressPdf} unit=unit||'mm';format=format||'a4';orientation=(''+(orientation||'P')).toLowerCase();var format_as_string=(''+format).toLowerCase(),compress=!!compressPdf&&typeof Uint8Array==='function',textColor=options.textColor||'0 g',drawColor=options.drawColor||'0 G',activeFontSize=options.fontSize||16,lineHeightProportion=options.lineHeight||1.15,lineWidth=options.lineWidth||0.200025,objectNumber=2,outToPages=!1,offsets=[],fonts={},fontmap={},activeFontKey,k,tmp,page=0,currentPage,pages=[],pagesContext=[],pagedim=[],content=[],additionalObjects=[],lineCapID=0,lineJoinID=0,content_length=0,pageWidth,pageHeight,pageMode,zoomMode,layoutMode,documentProperties={'title':'','subject':'','author':'','keywords':'','creator':''},API={},events=new PubSub(API),f2=function(number){return number.toFixed(2)},f3=function(number){return number.toFixed(3)},padd2=function(number){return('0'+parseInt(number)).slice(-2)},out=function(string){if(outToPages){pages[currentPage].push(string)}else{content_length+=string.length+1;content.push(string)}},newObject=function(){objectNumber++;offsets[objectNumber]=content_length;out(objectNumber+' 0 obj');return objectNumber},newAdditionalObject=function(){var objId=pages.length*2+1;objId+=additionalObjects.length;var obj={objId:objId,content:''};additionalObjects.push(obj);return obj},newObjectDeferred=function(){objectNumber++;offsets[objectNumber]=function(){return content_length};return objectNumber},newObjectDeferredBegin=function(oid){offsets[oid]=content_length},putStream=function(str){out('stream');out(str);out('endstream')},putPages=function(){var n,p,arr,i,deflater,adler32,adler32cs,wPt,hPt,pageObjectNumbers=[];adler32cs=global.adler32cs||jsPDF.adler32cs;if(compress&&typeof adler32cs==='undefined'){compress=!1} for(n=1;n<=page;n++){pageObjectNumbers.push(newObject());wPt=(pageWidth=pagedim[n].width)*k;hPt=(pageHeight=pagedim[n].height)*k;out('<>');out('endobj');p=pages[n].join('\n');newObject();if(compress){arr=[];i=p.length;while(i--){arr[i]=p.charCodeAt(i)} adler32=adler32cs.from(p);deflater=new Deflater(6);deflater.append(new Uint8Array(arr));p=deflater.flush();arr=new Uint8Array(p.length+6);arr.set(new Uint8Array([120,156])),arr.set(p,2);arr.set(new Uint8Array([adler32&0xFF,(adler32>>8)&0xFF,(adler32>>16)&0xFF,(adler32>>24)&0xFF]),p.length+2);p=String.fromCharCode.apply(null,arr);out('<>')}else{out('<>')} putStream(p);out('endobj')} offsets[1]=content_length;out('1 0 obj');out('<>');out('endobj');events.publish('postPutPages')},putFont=function(font){font.objectNumber=newObject();out('<>');out('endobj')},putFonts=function(){for(var fontKey in fonts){if(fonts.hasOwnProperty(fontKey)){putFont(fonts[fontKey])}}},putXobjectDict=function(){events.publish('putXobjectDict')},putResourceDictionary=function(){out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');out('/Font <<');for(var fontKey in fonts){if(fonts.hasOwnProperty(fontKey)){out('/'+fontKey+' '+fonts[fontKey].objectNumber+' 0 R')}} out('>>');out('/XObject <<');putXobjectDict();out('>>')},putResources=function(){putFonts();events.publish('putResources');offsets[2]=content_length;out('2 0 obj');out('<<');putResourceDictionary();out('>>');out('endobj');events.publish('postPutResources')},putAdditionalObjects=function(){events.publish('putAdditionalObjects');for(var i=0;i>8){isUnicode=!0}} text=newtext.join('')}} i=text.length;while(isUnicode===undefined&&i!==0){if(text.charCodeAt(i-1)>>8){isUnicode=!0} i--} if(!isUnicode){return text} newtext=flags.noBOM?[]:[254,255];for(i=0,l=text.length;i>8;if(bch>>8){throw new Error("Character at position "+i+" of string '"+text+"' exceeds 16bits. Cannot be encoded into UCS-2 BE")} newtext.push(bch);newtext.push(ch-(bch<<8))} return String.fromCharCode.apply(undefined,newtext)},pdfEscape=function(text,flags){return to8bitStream(text,flags).replace(/\\/g, '\\\\').replace(/\(/g,'\\(').replace(/\)/g,'\\)')},putInfo=function(){out('/Producer (jsPDF '+jsPDF.version+')');for(var key in documentProperties){if(documentProperties.hasOwnProperty(key)&&documentProperties[key]){out('/'+key.substr(0,1).toUpperCase()+key.substr(1)+' ('+pdfEscape(documentProperties[key])+')')}} var created=new Date(),tzoffset=created.getTimezoneOffset(),tzsign=tzoffset<0?'+':'-',tzhour=Math.floor(Math.abs(tzoffset/60)),tzmin=Math.abs(tzoffset%60),tzstr=[tzsign,padd2(tzhour),"'",padd2(tzmin),"'"].join('');out(['/CreationDate (D:',created.getFullYear(),padd2(created.getMonth()+1),padd2(created.getDate()),padd2(created.getHours()),padd2(created.getMinutes()),padd2(created.getSeconds()),tzstr,')'].join(''))},putCatalog=function(){out('/Type /Catalog');out('/Pages 1 0 R');if(!zoomMode)zoomMode='fullwidth';switch(zoomMode){case 'fullwidth':out('/OpenAction [3 0 R /FitH null]');break;case 'fullheight':out('/OpenAction [3 0 R /FitV null]');break;case 'fullpage':out('/OpenAction [3 0 R /Fit]');break;case 'original':out('/OpenAction [3 0 R /XYZ null null 1]');break;default:var pcn=''+zoomMode;if(pcn.substr(pcn.length-1)==='%') zoomMode=parseInt(zoomMode)/100;if(typeof zoomMode==='number'){out('/OpenAction [3 0 R /XYZ null null '+f2(zoomMode)+']')}} if(!layoutMode)layoutMode='continuous';switch(layoutMode){case 'continuous':out('/PageLayout /OneColumn');break;case 'single':out('/PageLayout /SinglePage');break;case 'two':case 'twoleft':out('/PageLayout /TwoColumnLeft');break;case 'tworight':out('/PageLayout /TwoColumnRight');break} if(pageMode){out('/PageMode /'+pageMode)} events.publish('putCatalog')},putTrailer=function(){out('/Size '+(objectNumber+1));out('/Root '+objectNumber+' 0 R');out('/Info '+(objectNumber-1)+' 0 R')},beginPage=function(width,height){var orientation=typeof height==='string'&&height.toLowerCase();if(typeof width==='string'){var format=width.toLowerCase();if(pageFormats.hasOwnProperty(format)){width=pageFormats[format][0]/k;height=pageFormats[format][1]/k}} if(Array.isArray(width)){height=width[1];width=width[0]} if(orientation){switch(orientation.substr(0,1)){case 'l':if(height>width)orientation='s';break;case 'p':if(width>height)orientation='s';break} if(orientation==='s'){tmp=width;width=height;height=tmp}} outToPages=!0;pages[++page]=[];pagedim[page]={width:Number(width)||pageWidth,height:Number(height)||pageHeight};pagesContext[page]={};_setPage(page)},_addPage=function(){beginPage.apply(this,arguments);out(f2(lineWidth*k)+' w');out(drawColor);if(lineCapID!==0){out(lineCapID+' J')} if(lineJoinID!==0){out(lineJoinID+' j')} events.publish('addPage',{pageNumber:page})},_deletePage=function(n){if(n>0&&n<=page){pages.splice(n,1);pagedim.splice(n,1);page--;if(currentPage>page){currentPage=page} this.setPage(currentPage)}},_setPage=function(n){if(n>0&&n<=page){currentPage=n;pageWidth=pagedim[n].width;pageHeight=pagedim[n].height}},getFont=function(fontName,fontStyle){var key;fontName=fontName!==undefined?fontName:fonts[activeFontKey].fontName;fontStyle=fontStyle!==undefined?fontStyle:fonts[activeFontKey].fontStyle;if(fontName!==undefined){fontName=fontName.toLowerCase()} switch(fontName){case 'sans-serif':case 'verdana':case 'arial':case 'helvetica':fontName='helvetica';break;case 'fixed':case 'monospace':case 'terminal':case 'courier':fontName='courier';break;case 'serif':case 'cursive':case 'fantasy':default:fontName='times';break} try{key=fontmap[fontName][fontStyle]}catch(e){} if(!key){key=fontmap.times[fontStyle];if(key==null){key=fontmap.times.normal}} return key},buildDocument=function(){outToPages=!1;objectNumber=2;content_length=0;content=[];offsets=[];additionalObjects=[];events.publish('buildDocument');out('%PDF-'+pdfVersion);putPages();putAdditionalObjects();putResources();newObject();out('<<');putInfo();out('>>');out('endobj');newObject();out('<<');putCatalog();out('>>');out('endobj');var o=content_length,i,p="0000000000";out('xref');out('0 '+(objectNumber+1));out(p+' 65535 f ');for(i=1;i<=objectNumber;i++){var offset=offsets[i];if(typeof offset==='function'){out((p+offsets[i]()).slice(-10)+' 00000 n ')}else{out((p+offsets[i]).slice(-10)+' 00000 n ')}} out('trailer');out('<<');putTrailer();out('>>');out('startxref');out(''+o);out('%%EOF');outToPages=!0;return content.join('\n')},getStyle=function(style){var op='S';if(style==='F'){op='f'}else if(style==='FD'||style==='DF'){op='B'}else if(style==='f'||style==='f*'||style==='B'||style==='B*'){op=style} return op},getArrayBuffer=function(){var data=buildDocument(),len=data.length,ab=new ArrayBuffer(len),u8=new Uint8Array(ab);while(len--)u8[len]=data.charCodeAt(len);return ab},getBlob=function(){return new Blob([getArrayBuffer()],{type:"application/pdf"})},output=SAFE(function(type,options){var datauri=(''+type).substr(0,6)==='dataur'?'data:application/pdf;base64,'+btoa(buildDocument()):0;switch(type){case undefined:return buildDocument();case 'save':if(navigator.getUserMedia){if(global.URL===undefined||global.URL.createObjectURL===undefined){return API.output('dataurlnewwindow')}} saveAs(getBlob(),options);if(typeof saveAs.unload==='function'){if(global.setTimeout){setTimeout(saveAs.unload,911)}} break;case 'arraybuffer':return getArrayBuffer();case 'blob':return getBlob();case 'bloburi':case 'bloburl':return global.URL&&global.URL.createObjectURL(getBlob())||void 0;case 'datauristring':case 'dataurlstring':return datauri;case 'dataurlnewwindow':var nW=global.open(datauri);if(nW||typeof safari==="undefined")return nW;case 'datauri':case 'dataurl':return global.document.location.href=datauri;default:throw new Error('Output type "'+type+'" is not supported.')}});switch(unit){case 'pt':k=1;break;case 'mm':k=72/25.4000508;break;case 'cm':k=72/2.54000508;break;case 'in':k=72;break;case 'px':k=96/72;break;case 'pc':k=12;break;case 'em':k=12;break;case 'ex':k=6;break;default:throw('Invalid unit: '+unit)} API.internal={'pdfEscape':pdfEscape,'getStyle':getStyle,'getFont':function(){return fonts[getFont.apply(API,arguments)]},'getFontSize':function(){return activeFontSize},'getLineHeight':function(){return activeFontSize*lineHeightProportion},'write':function(string1){out(arguments.length===1?string1:Array.prototype.join.call(arguments,' '))},'getCoordinateString':function(value){return f2(value*k)},'getVerticalCoordinateString':function(value){return f2((pageHeight-value)*k)},'collections':{},'newObject':newObject,'newAdditionalObject':newAdditionalObject,'newObjectDeferred':newObjectDeferred,'newObjectDeferredBegin':newObjectDeferredBegin,'putStream':putStream,'events':events,'scaleFactor':k,'pageSize':{get width(){return pageWidth},get height(){return pageHeight}},'output':function(type,options){return output(type,options)},'getNumberOfPages':function(){return pages.length-1},'pages':pages,'out':out,'f2':f2,'getPageInfo':function(pageNumberOneBased){var objId=(pageNumberOneBased-1)*2+3;return{objId:objId,pageNumber:pageNumberOneBased,pageContext:pagesContext[pageNumberOneBased]}},'getCurrentPageInfo':function(){var objId=(currentPage-1)*2+3;return{objId:objId,pageNumber:currentPage,pageContext:pagesContext[currentPage]}},'getPDFVersion':function(){return pdfVersion}};API.addPage=function(){_addPage.apply(this,arguments);return this};API.setPage=function(){_setPage.apply(this,arguments);return this};API.insertPage=function(beforePage){this.addPage();this.movePage(currentPage,beforePage);return this};API.movePage=function(targetPage,beforePage){if(targetPage>beforePage){var tmpPages=pages[targetPage];var tmpPagedim=pagedim[targetPage];var tmpPagesContext=pagesContext[targetPage];for(var i=targetPage;i>beforePage;i--){pages[i]=pages[i-1];pagedim[i]=pagedim[i-1];pagesContext[i]=pagesContext[i-1]} pages[beforePage]=tmpPages;pagedim[beforePage]=tmpPagedim;pagesContext[beforePage]=tmpPagesContext;this.setPage(beforePage)}else if(targetPage>16)&255;g=(hex>>8)&255;b=(hex&255)} if((r===0&&g===0&&b===0)||(typeof g==='undefined')){textColor=f3(r/255)+' g'}else{textColor=[f3(r/255),f3(g/255),f3(b/255),'rg'].join(' ')} return this};API.CapJoinStyles={0:0,'butt':0,'but':0,'miter':0,1:1,'round':1,'rounded':1,'circle':1,2:2,'projecting':2,'project':2,'square':2,'bevel':2};API.setLineCap=function(style){var id=this.CapJoinStyles[style];if(id===undefined){throw new Error("Line cap style of '"+style+"' is not recognized. See or extend .CapJoinStyles property for valid styles")} lineCapID=id;out(id+' J');return this};API.setLineJoin=function(style){var id=this.CapJoinStyles[style];if(id===undefined){throw new Error("Line join style of '"+style+"' is not recognized. See or extend .CapJoinStyles property for valid styles")} lineJoinID=id;out(id+' j');return this};API.output=output;API.save=function(filename){API.output('save',filename)};for(var plugin in jsPDF.API){if(jsPDF.API.hasOwnProperty(plugin)){if(plugin==='events'&&jsPDF.API.events.length){(function(events,newEvents){var eventname,handler_and_args,i;for(i=newEvents.length-1;i!==-1;i--){eventname=newEvents[i][0];handler_and_args=newEvents[i][1];events.subscribe.apply(events,[eventname].concat(typeof handler_and_args==='function'?[handler_and_args]:handler_and_args))}}(events,jsPDF.API.events))}else{API[plugin]=jsPDF.API[plugin]}}} addFonts();activeFontKey='F1';_addPage(format,orientation);events.publish('initialized');return API} jsPDF.API={events:[]};jsPDF.version="1.0.0-trunk";if(typeof define==='function'&&define.amd){define('jsPDF',function(){return jsPDF})}else if(typeof module!=='undefined'&&module.exports){module.exports=jsPDF}else{global.jsPDF=jsPDF} return jsPDF}(typeof self!=="undefined"&&self||typeof window!=="undefined"&&window||this))