Version Description
Added French translation thanks to Thierry Gaillou of JDFitForme. Uses newer version of pdf.js library for rendering PDFs.
Download this release
Release Info
Developer | danlester |
Plugin | PDF Embedder |
Version | 2.5.4 |
Comparing to | |
See all releases |
Code changes from version 2.5 to 2.5.4
- css/pdfemb-embed-pdf.css +1 -1
- js/all-pdfemb-basic.min.js +20 -20
- js/pdfemb-embed-pdf.js +15 -9
- js/pdfjs/compatibility.min.js +1 -1
- js/pdfjs/pdf.js +66 -11
- js/pdfjs/pdf.min.js +66 -11
- js/pdfjs/pdf.worker.js +1026 -432
- js/pdfjs/pdf.worker.min.js +1026 -432
- lang/pdf-embedder-fr_FR.mo +0 -0
- lang/pdf-embedder-fr_FR.po +630 -0
- pdf_embedder.php +2 -2
- readme.txt +12 -2
css/pdfemb-embed-pdf.css
CHANGED
@@ -134,7 +134,7 @@ div.pdfemb-toolbar-bottom {
|
|
134 |
padding-top: 1px;
|
135 |
}
|
136 |
|
137 |
-
div.pdfemb-toolbar button {
|
138 |
background-color: hsla(0,0%,0%,.12);
|
139 |
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
140 |
background-clip: padding-box;
|
134 |
padding-top: 1px;
|
135 |
}
|
136 |
|
137 |
+
div.pdfemb-toolbar button, div.pdfemb-toolbar button[disabled] {
|
138 |
background-color: hsla(0,0%,0%,.12);
|
139 |
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
140 |
background-clip: padding-box;
|
js/all-pdfemb-basic.min.js
CHANGED
@@ -1,24 +1,24 @@
|
|
1 |
-
function
|
2 |
-
d&&c.fn.pdfEmbedder.addToolbar(b,!0,"on"==b.data("toolbar-fixed"),f);"top"!=d&&c.fn.pdfEmbedder.addToolbar(b,!1,"on"==b.data("toolbar-fixed"),f);b.on("pdfembGotopage",function(a,f){f>b.data("pdfDoc").numPages||0>=f||b.data("pagenum")==f||(b.data("pagenum",f),c.fn.pdfEmbedder.queueRenderPage(b,f),pdfembPremiumJumpToTop(b))});b.on("pdfembGotoHash",function(a,f){if(f.dest){dest=f.dest;var d;"string"===typeof dest?(destString=dest,d=b.data("pdfDoc").getDestination(dest)):d=Promise.resolve(dest);d.then(function(a){a instanceof
|
3 |
-
Array&&!(1>a.length)&&b.data("pdfDoc").getPageIndex(a[0]).then(function(a){a+=1;a>b.data("pdfDoc").numPages||0>=a||b.data("pagenum")==a||(b.data("pagenum",a),c.fn.pdfEmbedder.queueRenderPage(b,a),pdfembPremiumJumpToTop(b))})})}});b.on("pdfembGotoAction",function(a,f){var d=b.data("pagenum"),e=d;switch(f){case "GoBack":--e;break;case "GoForward":++e;break;case "NextPage":++e;break;case "PrevPage":--e;break;case "LastPage":e=b.data("pdfDoc").numPages;break;case "FirstPage":e=1}e==d||e>b.data("pdfDoc").numPages||
|
4 |
-
0>=e||(b.data("pagenum",e),c.fn.pdfEmbedder.queueRenderPage(b,e))});b.data("pageCount",a.numPages);(!b.data("pagenum")||1>b.data("pagenum")||b.data("pagenum")>a.numPages)&&b.data("pagenum",1);b.data("showIsSecure",f);b.data("pageNumPending",null);b.data("zoom",100);c.fn.pdfEmbedder.renderPage(b,b.data("pagenum"));b.find("span.pdfemb-page-count").text(a.numPages);d=new pdfembGrabToPan({element:b.find("div.pdfemb-inner-div")[0]});b.data("grabtopan",d);c(window).resize(function(){setTimeout(function(){c.fn.pdfEmbedder.queueRenderPage(b,
|
5 |
-
b.data("pagenum"))},100)})},d=function(a,f){PDFJS.getDocument(a).then(function(a){h(a,f)},function(a){var f=document.createTextNode(a.message);"UnexpectedResponseException"==a.name&&0==a.status&&(f=c("<span></span>").append(document.createTextNode(pdfemb_trans.objectL10n.domainerror+" ")).append(c('<a href="https://wp-pdf.com/troubleshooting/#unexpected" target="_blank">'+pdfemb_trans.objectL10n.clickhereinfo+"</a>")));b.empty().append(c("<div></div>",{"class":"pdfemb-errormsg"}).append(f))})};if(b.data("pdfDoc"))h(b.data("pdfDoc"),
|
6 |
-
b.data("showIsSecure"));else{var f=b.attr("data-pdf-url");pdfembGetPDF(f,d)}});return this};c.fn.pdfEmbedder.annotationsLayerFactory="undefined"!=typeof pdfembPremiumAnnotationsLayerFactory?new pdfembPremiumAnnotationsLayerFactory:{createAnnotationsLayerBuilder:function(a,c){return null}};c.fn.pdfEmbedder.checkForResize=function(a){var e=c(window).height(),b=c(window).width(),h=a.data("checked-window-height"),d=a.data("checked-window-width");if(!h||!d)a.data("checked-window-height",e),a.data("checked-window-width",
|
7 |
-
b);else if(h!=e||d!=b)c.fn.pdfEmbedder.queueRenderPage(a,a.data("pagenum")),a.data("checked-window-height",e),a.data("checked-window-width",b);"true"!=a.data("fullScreenClosed")&&setTimeout(function(){c.fn.pdfEmbedder.checkForResize(a)},1E3)};c.fn.pdfEmbedder.renderPage=function(a,e,b){a.data("pageRendering",!0);a.data("pdfDoc").getPage(e).then(function(h){var d=a.find(".pdfemb-the-canvas"),f=null,r=null,u=null,v=null;b&&(u=d.width(),v=d.height(),r=d[0].getContext("2d"),f=r.getImageData(0,0,u,v));
|
8 |
-
var n,g=h.getViewport(1),l=g.width,m=g.height;if(0>=l||0>=m)a.empty().append(document.createTextNode(pdfemb_trans.objectL10n.widthheightinvalid));else{var q=a.parent().width(),g=l,p=m;if("max"==a.data("width"))g=q;else if("auto"==a.data("width"))g=l;else if(g=parseInt(a.data("width"),10),isNaN(g)||0>=g)g=q;0>=g&&(g=l);g>q&&0<q&&(g=q);n=g/l;var p=m*n,w=a.find("div.pdfemb-toolbar-fixed"),t=(q=pdfembWantMobile(c,a,g,k))?0:w.length,k=parseInt(a.data("height"),10);if(isNaN(k)||0>=k||k>p)k="auto"==a.data("height")?
|
9 |
-
a.parent().height()-t*w.height():p;var g=Math.floor(g),p=Math.floor(p),x=100,l=g,m=p,y=0,z=0;q||(x=a.data("zoom"),l=g*x/100,m=p*x/100,l<g&&(y=(g-l)/2),m<k&&(z=(k-m)/2));var A=h.getViewport(n*x/100);g!=a.width()&&a.width(g);a.height()!=k&&a.height(k+t*w.height());n=a.find("div.pdfemb-inner-div");var x=n[0].scrollLeft,B=n[0].scrollTop;n.width(g);n.height(k);w=w.filter(".pdfemb-toolbar-top");0<t&&n.css("top",w.height());d[0].width=l;d[0].height=m;d.css("width",l);d.css("height",m);d.css("left",y).css("top",
|
10 |
-
z);(l>g||m>p||m>k)&&!q?(k=a.data("fromZoom"),t=a.data("toZoom"),0<k&&0<t&&(y=B+p/2,n.scrollLeft((x+g/2)*t/k-g/2),n.scrollTop(y*t/k-p/2)),a.data("grabtopan").activate()):("on"==a.data("fullScreen")?a.data("grabtopan").activate():a.data("grabtopan").deactivate(),a.find("div.pdfemb-inner-div").scrollLeft(0).scrollTop(0));a.data("fromZoom",0).data("toZoom",0);pdfembMakeMobile(c,q,a);b?(a.data("pagenum",e),a.data("pageRendering",!1),d=c("<canvas>").attr("width",f.width).attr("height",f.height)[0],d.getContext("2d").putImageData(f,
|
11 |
-
0,0),r.scale(l/u,m/v),r.drawImage(d,0,0)):(f={canvasContext:d[0].getContext("2d"),viewport:A},h.render(f).promise.then(function(){a.data("pagenum",e);a.data("pageRendering",!1);a.find("div.pdfemb-toolbar .pdfemb-page-num").each(function(a,b){var f=c(b);f.is("span")?f.text(e):f.val(e)});e<a.data("pageCount")?a.find(".pdfemb-next").removeAttr("disabled").removeClass("pdfemb-btndisabled"):a.find(".pdfemb-next").attr("disabled","disabled").addClass("pdfemb-btndisabled");1<e?a.find(".pdfemb-prev").removeAttr("disabled").removeClass("pdfemb-btndisabled"):
|
12 |
-
a.find(".pdfemb-prev").attr("disabled","disabled").addClass("pdfemb-btndisabled");var b=c.fn.pdfEmbedder.annotationsLayerFactory.createAnnotationsLayerBuilder(a.find("div.pdfemb-inner-div")[0],h);null!=b&&(a.find("div.pdfembAnnotationLayer").remove(),b.setupAnnotations(A,a.data("newwindow")));null!==a.data("pageNumPending")&&(c.fn.pdfEmbedder.renderPage(a,a.data("pageNumPending")),a.data("pageNumPending",null))}))}})};c.fn.pdfEmbedder.queueRenderPage=function(a,e,b){a.data("pageRendering")?a.data("pageNumPending",
|
13 |
-
e):c.fn.pdfEmbedder.renderPage(a,e,b)};c.fn.pdfEmbedder.goFullScreen=function(a){a=c('<div class="pdfemb-fs-window"></div>');c(document.body).append(a)};c.fn.pdfEmbedder.changeZoom=function(a,e){var b=a.data("zoom"),h=b+e;a.data("zoom",h);a.find("span.pdfemb-zoom").text(h+"%");c.fn.pdfEmbedder.queueRenderPage(a,a.data("pagenum"));a.data("fromZoom",b).data("toZoom",h)};c.fn.pdfEmbedder.magnifyZoom=function(a,e){var b=a.data("zoom"),h=Math.floor(b*e);20>h&&(h=20);500<h&&(h=500);a.data("zoom",h);a.find("span.pdfemb-zoom").text(h+
|
14 |
-
"%");c.fn.pdfEmbedder.queueRenderPage(a,a.data("pagenum"),!0);a.data("fromZoom",b).data("toZoom",h)};c.fn.pdfEmbedder.addToolbar=function(a,e,b,h){var d=c("<div></div>",{"class":"pdfemb-toolbar pdfemb-toolbar"+(b?"-fixed":"-hover")+" "+(e?" pdfemb-toolbar-top":"pdfemb-toolbar-bottom")}),f=c('<button class="pdfemb-prev" title="'+pdfemb_trans.objectL10n.prev+'"></button>');d.append(f);var r=c('<button class="pdfemb-next" title="'+pdfemb_trans.objectL10n.next+'"></button>');d.append(r);d.append(c('<div class="pdfemb-page-area">'+
|
15 |
-
pdfemb_trans.objectL10n.page+' <span class="pdfemb-page-num">0</span> / <span class="pdfemb-page-count"></span></div>'));var u=c('<button class="pdfemb-zoomout" title="'+pdfemb_trans.objectL10n.zoomout+'"></button>');d.append(u);var v=c('<button class="pdfemb-zoomin" title="'+pdfemb_trans.objectL10n.zoomin+'"></button>');d.append(v);d.append(c("<div>"+pdfemb_trans.objectL10n.zoom+' <span class="pdfemb-zoom">100%</span></div>'));h&&d.append(c("<div>"+pdfemb_trans.objectL10n.secure+"</div>"));e?a.prepend(d):
|
16 |
-
a.append(d);f.on("click",function(b){1>=a.data("pagenum")||(a.data("pagenum",a.data("pagenum")-1),c.fn.pdfEmbedder.queueRenderPage(a,a.data("pagenum")),pdfembPremiumJumpToTop(a))});r.on("click",function(b){a.data("pagenum")>=a.data("pdfDoc").numPages||(a.data("pagenum",a.data("pagenum")+1),c.fn.pdfEmbedder.queueRenderPage(a,a.data("pagenum")),pdfembPremiumJumpToTop(a))});v.on("click",function(b){500<=a.data("zoom")||c.fn.pdfEmbedder.changeZoom(a,10)});u.on("click",function(b){20>=a.data("zoom")||
|
17 |
-
c.fn.pdfEmbedder.changeZoom(a,-10)});pdfembAddMoreToolbar(c,d,a);b||(a.on("mouseenter",function(b){b=a.find("div.pdfemb-toolbar-hover");!0!==b.data("no-hover")&&b.show()}),a.on("mouseleave",function(b){a.find("div.pdfemb-toolbar-hover").hide()}));pdfemb_trans.poweredby&&d.append(c("<div></div>",{"class":"pdfemb-poweredby"}).append(c('<a href="https://wp-pdf.com/?utm_source=Poweredby&utm_medium=freemium&utm_campaign=Freemium" target="_blank">wp-pdf.com</a>')))};PDFJS.workerSrc=pdfemb_trans.worker_src;
|
18 |
-
PDFJS.cMapUrl=pdfemb_trans.cmap_url;PDFJS.cMapPacked=!0;c(".pdfemb-viewer").pdfEmbedder()});var pdfembGrabToPan=function(){function c(a){this.element=a.element;this.document=a.element.ownerDocument;"function"===typeof a.ignoreTarget&&(this.ignoreTarget=a.ignoreTarget);this.onActiveChanged=a.onActiveChanged;this.activate=this.activate.bind(this);this.deactivate=this.deactivate.bind(this);this.toggle=this.toggle.bind(this);this._onmousedown=this._onmousedown.bind(this);this._onmousemove=this._onmousemove.bind(this);this._onmousewheel=this._onmousewheel.bind(this);this._endPan=this._endPan.bind(this);
|
19 |
(this.overlay=document.createElement("div")).className="grab-to-pan-grabbing"}c.prototype={CSS_CLASS_GRAB:"grab-to-pan-grab",activate:function(){if(!this.active&&(this.active=!0,this.element.addEventListener("mousedown",this._onmousedown,!0),this.element.addEventListener("DOMMouseScroll",this._onmousewheel),this.element.addEventListener("mousewheel",this._onmousewheel),this.element.classList.add(this.CSS_CLASS_GRAB),this.onActiveChanged))this.onActiveChanged(!0)},deactivate:function(){if(this.active&&
|
20 |
(this.active=!1,this.element.removeEventListener("mousedown",this._onmousedown,!0),this._endPan(),this.element.classList.remove(this.CSS_CLASS_GRAB),this.onActiveChanged))this.onActiveChanged(!1)},toggle:function(){this.active?this.deactivate():this.activate()},ignoreTarget:function(b){return b[a]("a[href], a[href] *, input, textarea, button, button *, select, option")},_onmousedown:function(a){if(0===a.button&&!this.ignoreTarget(a.target)){this.scrollLeftStart=this.element.scrollLeft;this.scrollTopStart=
|
21 |
this.element.scrollTop;this.clientXStart=a.clientX;this.clientYStart=a.clientY;this.document.addEventListener("mousemove",this._onmousemove,!0);this.document.addEventListener("mouseup",this._endPan,!0);this.element.addEventListener("scroll",this._endPan,!0);a.preventDefault();a.stopPropagation();this.document.documentElement.classList.add(this.CSS_CLASS_GRABBING);var b=document.activeElement;b&&!b.contains(a.target)&&b.blur()}},_onmousemove:function(a){this.element.removeEventListener("scroll",this._endPan,
|
22 |
-
!0);var b;b="buttons"in a&&
|
23 |
this.element.scrollTop;this.element.scrollTop=this.scrollTopStart-40*a;this.overlay.parentNode||document.body.appendChild(this.overlay)},_endPan:function(){this.element.removeEventListener("scroll",this._endPan,!0);this.document.removeEventListener("mousemove",this._onmousemove,!0);this.document.removeEventListener("mouseup",this._endPan,!0);this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)}};var a;["webkitM","mozM","msM","oM","m"].some(function(b){b+="atches";b in document.documentElement&&
|
24 |
-
(a=b);b+="Selector";b in document.documentElement&&(a=b);return a});var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var pdfembGrabToPan=function(){function c(a){this.element=a.element;this.document=a.element.ownerDocument;"function"===typeof a.ignoreTarget&&(this.ignoreTarget=a.ignoreTarget);this.onActiveChanged=a.onActiveChanged;this.activate=this.activate.bind(this);this.deactivate=this.deactivate.bind(this);this.toggle=this.toggle.bind(this);this._onmousedown=this._onmousedown.bind(this);this._onmousemove=this._onmousemove.bind(this);this._onmousewheel=this._onmousewheel.bind(this);this._endPan=this._endPan.bind(this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
(this.overlay=document.createElement("div")).className="grab-to-pan-grabbing"}c.prototype={CSS_CLASS_GRAB:"grab-to-pan-grab",activate:function(){if(!this.active&&(this.active=!0,this.element.addEventListener("mousedown",this._onmousedown,!0),this.element.addEventListener("DOMMouseScroll",this._onmousewheel),this.element.addEventListener("mousewheel",this._onmousewheel),this.element.classList.add(this.CSS_CLASS_GRAB),this.onActiveChanged))this.onActiveChanged(!0)},deactivate:function(){if(this.active&&
|
3 |
(this.active=!1,this.element.removeEventListener("mousedown",this._onmousedown,!0),this._endPan(),this.element.classList.remove(this.CSS_CLASS_GRAB),this.onActiveChanged))this.onActiveChanged(!1)},toggle:function(){this.active?this.deactivate():this.activate()},ignoreTarget:function(b){return b[a]("a[href], a[href] *, input, textarea, button, button *, select, option")},_onmousedown:function(a){if(0===a.button&&!this.ignoreTarget(a.target)){this.scrollLeftStart=this.element.scrollLeft;this.scrollTopStart=
|
4 |
this.element.scrollTop;this.clientXStart=a.clientX;this.clientYStart=a.clientY;this.document.addEventListener("mousemove",this._onmousemove,!0);this.document.addEventListener("mouseup",this._endPan,!0);this.element.addEventListener("scroll",this._endPan,!0);a.preventDefault();a.stopPropagation();this.document.documentElement.classList.add(this.CSS_CLASS_GRABBING);var b=document.activeElement;b&&!b.contains(a.target)&&b.blur()}},_onmousemove:function(a){this.element.removeEventListener("scroll",this._endPan,
|
5 |
+
!0);var b;b="buttons"in a&&f?!(a.buttons|1):e||d?0===a.which:void 0;b?this._endPan():(b=a.clientX-this.clientXStart,this.element.scrollTop=this.scrollTopStart-(a.clientY-this.clientYStart),this.element.scrollLeft=this.scrollLeftStart-b,this.overlay.parentNode||document.body.appendChild(this.overlay))},_onmousewheel:function(a){this.element.removeEventListener("scroll",this._endPan,!0);a="DOMMouseScroll"===a.type?-a.detail:a.wheelDelta/40;this.scrollLeftStart=this.element.scrollLeft;this.scrollTopStart=
|
6 |
this.element.scrollTop;this.element.scrollTop=this.scrollTopStart-40*a;this.overlay.parentNode||document.body.appendChild(this.overlay)},_endPan:function(){this.element.removeEventListener("scroll",this._endPan,!0);this.document.removeEventListener("mousemove",this._onmousemove,!0);this.document.removeEventListener("mouseup",this._endPan,!0);this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)}};var a;["webkitM","mozM","msM","oM","m"].some(function(b){b+="atches";b in document.documentElement&&
|
7 |
+
(a=b);b+="Selector";b in document.documentElement&&(a=b);return a});var f=!document.documentMode||9<document.documentMode,b=window.chrome,e=b&&(b.webstore||b.app),d=/Apple/.test(navigator.vendor)&&/Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent);return c}();function pdfembGetPDF(c,a){a(c,!1)}function pdfembWantMobile(c,a,f,b){return!1}function pdfembMakeMobile(c,a,f){}function pdfembAddMoreToolbar(c,a,f){}function pdfembPremiumJumpToTop(c){};jQuery(document).ready(function(c){c.fn.pdfEmbedder=function(){this.each(function(a,f){var b=c(f);b.append(c("<div></div>",{"class":"pdfemb-loadingmsg"}).append(document.createTextNode(pdfemb_trans.objectL10n.loading)));"on"==b.data("disablerightclick")&&b.bind("contextmenu",function(a){a.preventDefault()});var e=function(a,d){b.empty().append(c("<div></div>",{"class":"pdfemb-inner-div"}).append(c("<canvas></canvas>",{"class":"pdfemb-the-canvas"})));b.data("pdfDoc",a);var f=b.data("toolbar");"bottom"!=
|
8 |
+
f&&c.fn.pdfEmbedder.addToolbar(b,!0,"on"==b.data("toolbar-fixed"),d);"top"!=f&&c.fn.pdfEmbedder.addToolbar(b,!1,"on"==b.data("toolbar-fixed"),d);b.on("pdfembGotopage",function(a,g){g>b.data("pdfDoc").numPages||0>=g||b.data("pagenum")==g||(b.data("pagenum",g),c.fn.pdfEmbedder.queueRenderPage(b,g),pdfembPremiumJumpToTop(b))});b.on("pdfembGotoHash",function(a,g){if(g.dest){dest=g.dest;var d;"string"===typeof dest?(destString=dest,d=b.data("pdfDoc").getDestination(dest)):d=Promise.resolve(dest);d.then(function(a){a instanceof
|
9 |
+
Array&&!(1>a.length)&&b.data("pdfDoc").getPageIndex(a[0]).then(function(a){a+=1;a>b.data("pdfDoc").numPages||0>=a||b.data("pagenum")==a||(b.data("pagenum",a),c.fn.pdfEmbedder.queueRenderPage(b,a),pdfembPremiumJumpToTop(b))})})}});b.on("pdfembGotoAction",function(a,d){var f=b.data("pagenum"),e=f;switch(d){case "GoBack":--e;break;case "GoForward":++e;break;case "NextPage":++e;break;case "PrevPage":--e;break;case "LastPage":e=b.data("pdfDoc").numPages;break;case "FirstPage":e=1}e==f||e>b.data("pdfDoc").numPages||
|
10 |
+
0>=e||(b.data("pagenum",e),c.fn.pdfEmbedder.queueRenderPage(b,e))});b.data("pageCount",a.numPages);(!b.data("pagenum")||1>b.data("pagenum")||b.data("pagenum")>a.numPages)&&b.data("pagenum",1);b.data("showIsSecure",d);b.data("pageNumPending",null);b.data("zoom",100);c.fn.pdfEmbedder.renderPage(b,b.data("pagenum"));b.find("span.pdfemb-page-count").text(a.numPages);f=new pdfembGrabToPan({element:b.find("div.pdfemb-inner-div")[0]});b.data("grabtopan",f);c(window).resize(function(){setTimeout(function(){c.fn.pdfEmbedder.queueRenderPage(b,
|
11 |
+
b.data("pagenum"))},100)})},d=function(a,d){null===a?b.empty().append(c("<div></div>",{"class":"pdfemb-errormsg"}).append(msgnode=c("<span></span>").append(document.createTextNode("Failed to load and decrypt PDF")))):PDFJS.getDocument(a).then(function(a){e(a,d)},function(a){var d=document.createTextNode(a.message);"UnexpectedResponseException"==a.name&&0==a.status&&(d=c("<span></span>").append(document.createTextNode(pdfemb_trans.objectL10n.domainerror+" ")).append(c('<a href="https://wp-pdf.com/troubleshooting/#unexpected" target="_blank">'+
|
12 |
+
pdfemb_trans.objectL10n.clickhereinfo+"</a>")));b.empty().append(c("<div></div>",{"class":"pdfemb-errormsg"}).append(d))})};if(b.data("pdfDoc"))e(b.data("pdfDoc"),b.data("showIsSecure"));else{var m=b.attr("data-pdf-url");pdfembGetPDF(m,d)}});return this};c.fn.pdfEmbedder.annotationsLayerFactory="undefined"!=typeof pdfembPremiumAnnotationsLayerFactory?new pdfembPremiumAnnotationsLayerFactory:{createAnnotationsLayerBuilder:function(a,c){return null}};c.fn.pdfEmbedder.checkForResize=function(a){var f=
|
13 |
+
c(window).height(),b=c(window).width(),e=a.data("checked-window-height"),d=a.data("checked-window-width");if(!e||!d)a.data("checked-window-height",f),a.data("checked-window-width",b);else if(e!=f||d!=b)c.fn.pdfEmbedder.queueRenderPage(a,a.data("pagenum")),a.data("checked-window-height",f),a.data("checked-window-width",b);"true"!=a.data("fullScreenClosed")&&setTimeout(function(){c.fn.pdfEmbedder.checkForResize(a)},1E3)};c.fn.pdfEmbedder.renderPage=function(a,f,b){a.data("pageRendering",!0);a.data("pdfDoc").getPage(f).then(function(e){var d=
|
14 |
+
a.find(".pdfemb-the-canvas"),m=null,r=null,u=null,v=null;b&&(u=d.width(),v=d.height(),r=d[0].getContext("2d"),m=r.getImageData(0,0,u,v));var n,g=e.getViewport(1),k=g.width,l=g.height;if(0>=k||0>=l)a.empty().append(document.createTextNode(pdfemb_trans.objectL10n.widthheightinvalid));else{var q=a.parent().width(),g=k,p=l;if("max"==a.data("width"))g=q;else if("auto"==a.data("width"))g=k;else if(g=parseInt(a.data("width"),10),isNaN(g)||0>=g)g=q;0>=g&&(g=k);g>q&&0<q&&(g=q);n=g/k;var p=l*n,w=a.find("div.pdfemb-toolbar-fixed"),
|
15 |
+
t=(q=pdfembWantMobile(c,a,g,h))?0:w.length,h=parseInt(a.data("height"),10);if(isNaN(h)||0>=h||h>p)h="auto"==a.data("height")?a.parent().height()-t*w.height():p;var g=Math.floor(g),p=Math.floor(p),x=100,k=g,l=p,y=0,z=0;q||(x=a.data("zoom"),k=g*x/100,l=p*x/100,k<g&&(y=(g-k)/2),l<h&&(z=(h-l)/2));var A=e.getViewport(n*x/100);g!=a.width()&&a.width(g);a.height()!=h&&a.height(h+t*w.height());n=a.find("div.pdfemb-inner-div");var x=n[0].scrollLeft,B=n[0].scrollTop;n.width(g);n.height(h);w=w.filter(".pdfemb-toolbar-top");
|
16 |
+
0<t&&n.css("top",w.height());d[0].width=k;d[0].height=l;d.css("width",k);d.css("height",l);d.css("left",y).css("top",z);(k>g||l>p||l>h)&&!q?(h=a.data("fromZoom"),t=a.data("toZoom"),0<h&&0<t&&(y=B+p/2,n.scrollLeft((x+g/2)*t/h-g/2),n.scrollTop(y*t/h-p/2)),a.data("grabtopan").activate()):("on"==a.data("fullScreen")?a.data("grabtopan").activate():a.data("grabtopan").deactivate(),a.find("div.pdfemb-inner-div").scrollLeft(0).scrollTop(0));a.data("fromZoom",0).data("toZoom",0);pdfembMakeMobile(c,q,a);b?
|
17 |
+
(a.data("pagenum",f),a.data("pageRendering",!1),d=c("<canvas>").attr("width",m.width).attr("height",m.height)[0],d.getContext("2d").putImageData(m,0,0),r.scale(k/u,l/v),r.drawImage(d,0,0)):(m={canvasContext:d[0].getContext("2d"),viewport:A},e.render(m).promise.then(function(){a.data("pagenum",f);a.data("pageRendering",!1);a.find("div.pdfemb-toolbar .pdfemb-page-num").each(function(a,b){var d=c(b);d.is("span")?d.text(f):d.val(f)});f<a.data("pageCount")?a.find(".pdfemb-next").removeAttr("disabled").removeClass("pdfemb-btndisabled"):
|
18 |
+
a.find(".pdfemb-next").attr("disabled","disabled").addClass("pdfemb-btndisabled");1<f?a.find(".pdfemb-prev").removeAttr("disabled").removeClass("pdfemb-btndisabled"):a.find(".pdfemb-prev").attr("disabled","disabled").addClass("pdfemb-btndisabled");var b=c.fn.pdfEmbedder.annotationsLayerFactory.createAnnotationsLayerBuilder(a.find("div.pdfemb-inner-div")[0],e);null!=b&&(a.find("div.pdfembAnnotationLayer").remove(),b.setupAnnotations(A,a.data("newwindow")));null!==a.data("pageNumPending")&&(c.fn.pdfEmbedder.renderPage(a,
|
19 |
+
a.data("pageNumPending")),a.data("pageNumPending",null))}))}})};c.fn.pdfEmbedder.queueRenderPage=function(a,f,b){a.data("pageRendering")?a.data("pageNumPending",f):c.fn.pdfEmbedder.renderPage(a,f,b)};c.fn.pdfEmbedder.goFullScreen=function(a){a=c('<div class="pdfemb-fs-window"></div>');c(document.body).append(a)};c.fn.pdfEmbedder.changeZoom=function(a,f){var b=a.data("zoom"),e=b+f;a.data("zoom",e);a.find("span.pdfemb-zoom").text(e+"%");c.fn.pdfEmbedder.queueRenderPage(a,a.data("pagenum"));a.data("fromZoom",
|
20 |
+
b).data("toZoom",e)};c.fn.pdfEmbedder.magnifyZoom=function(a,f){var b=a.data("zoom"),e=Math.floor(b*f);20>e&&(e=20);500<e&&(e=500);a.data("zoom",e);a.find("span.pdfemb-zoom").text(e+"%");c.fn.pdfEmbedder.queueRenderPage(a,a.data("pagenum"),!0);a.data("fromZoom",b).data("toZoom",e)};c.fn.pdfEmbedder.addToolbar=function(a,f,b,e){var d=c("<div></div>",{"class":"pdfemb-toolbar pdfemb-toolbar"+(b?"-fixed":"-hover")+" "+(f?" pdfemb-toolbar-top":"pdfemb-toolbar-bottom")}),m=c('<button class="pdfemb-prev" title="'+
|
21 |
+
pdfemb_trans.objectL10n.prev+'"></button>');d.append(m);var r=c('<button class="pdfemb-next" title="'+pdfemb_trans.objectL10n.next+'"></button>');d.append(r);d.append(c('<div class="pdfemb-page-area">'+pdfemb_trans.objectL10n.page+' <span class="pdfemb-page-num">0</span> / <span class="pdfemb-page-count"></span></div>'));var u=c('<button class="pdfemb-zoomout" title="'+pdfemb_trans.objectL10n.zoomout+'"></button>');d.append(u);var v=c('<button class="pdfemb-zoomin" title="'+pdfemb_trans.objectL10n.zoomin+
|
22 |
+
'"></button>');d.append(v);d.append(c("<div>"+pdfemb_trans.objectL10n.zoom+' <span class="pdfemb-zoom">100%</span></div>'));e&&d.append(c("<div>"+pdfemb_trans.objectL10n.secure+"</div>"));f?a.prepend(d):a.append(d);m.on("click",function(b){1>=a.data("pagenum")||(a.data("pagenum",a.data("pagenum")-1),c.fn.pdfEmbedder.queueRenderPage(a,a.data("pagenum")),pdfembPremiumJumpToTop(a))});r.on("click",function(b){a.data("pagenum")>=a.data("pdfDoc").numPages||(a.data("pagenum",a.data("pagenum")+1),c.fn.pdfEmbedder.queueRenderPage(a,
|
23 |
+
a.data("pagenum")),pdfembPremiumJumpToTop(a))});v.on("click",function(b){500<=a.data("zoom")||c.fn.pdfEmbedder.changeZoom(a,10)});u.on("click",function(b){20>=a.data("zoom")||c.fn.pdfEmbedder.changeZoom(a,-10)});pdfembAddMoreToolbar(c,d,a);b||(a.on("mouseenter",function(b){b=a.find("div.pdfemb-toolbar-hover");!0!==b.data("no-hover")&&b.show()}),a.on("mouseleave",function(b){a.find("div.pdfemb-toolbar-hover").hide()}));pdfemb_trans.poweredby&&d.append(c("<div></div>",{"class":"pdfemb-poweredby"}).append(c('<a href="https://wp-pdf.com/?utm_source=Poweredby&utm_medium=freemium&utm_campaign=Freemium" target="_blank">wp-pdf.com</a>')))};
|
24 |
+
PDFJS.workerSrc=pdfemb_trans.worker_src;PDFJS.cMapUrl=pdfemb_trans.cmap_url;PDFJS.cMapPacked=!0;c(".pdfemb-viewer").pdfEmbedder()});
|
js/pdfemb-embed-pdf.js
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
jQuery(document).ready(function ($) {
|
4 |
|
5 |
$.fn.pdfEmbedder = function() {
|
6 |
-
|
7 |
this.each(function(index, rawDivContainer) {
|
8 |
-
|
9 |
var divContainer = $(rawDivContainer);
|
10 |
-
|
11 |
divContainer.append($('<div></div>', {'class': 'pdfemb-loadingmsg'}).append(document.createTextNode(pdfemb_trans.objectL10n.loading)));
|
12 |
|
13 |
// Disable right click?
|
@@ -151,13 +151,19 @@ jQuery(document).ready(function ($) {
|
|
151 |
}, 100);
|
152 |
});
|
153 |
};
|
154 |
-
|
155 |
var callback = function(pdf, showIsSecure) {
|
156 |
-
|
157 |
/**
|
158 |
* Asynchronously downloads PDF.
|
159 |
*/
|
160 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
PDFJS.getDocument(pdf).then(
|
162 |
function(pdfDoc_) {
|
163 |
initPdfDoc(pdfDoc_, showIsSecure)
|
@@ -172,7 +178,7 @@ jQuery(document).ready(function ($) {
|
|
172 |
divContainer.empty().append($('<div></div>', {'class': 'pdfemb-errormsg'}).append(msgnode));
|
173 |
}
|
174 |
);
|
175 |
-
|
176 |
};
|
177 |
|
178 |
if (divContainer.data('pdfDoc')) {
|
@@ -185,7 +191,7 @@ jQuery(document).ready(function ($) {
|
|
185 |
});
|
186 |
|
187 |
return this;
|
188 |
-
|
189 |
};
|
190 |
|
191 |
|
@@ -610,7 +616,7 @@ jQuery(document).ready(function ($) {
|
|
610 |
}
|
611 |
};
|
612 |
|
613 |
-
// Apply plugin to relevant divs
|
614 |
|
615 |
PDFJS.workerSrc = pdfemb_trans.worker_src;
|
616 |
PDFJS.cMapUrl = pdfemb_trans.cmap_url;
|
3 |
jQuery(document).ready(function ($) {
|
4 |
|
5 |
$.fn.pdfEmbedder = function() {
|
6 |
+
|
7 |
this.each(function(index, rawDivContainer) {
|
8 |
+
|
9 |
var divContainer = $(rawDivContainer);
|
10 |
+
|
11 |
divContainer.append($('<div></div>', {'class': 'pdfemb-loadingmsg'}).append(document.createTextNode(pdfemb_trans.objectL10n.loading)));
|
12 |
|
13 |
// Disable right click?
|
151 |
}, 100);
|
152 |
});
|
153 |
};
|
154 |
+
|
155 |
var callback = function(pdf, showIsSecure) {
|
156 |
+
|
157 |
/**
|
158 |
* Asynchronously downloads PDF.
|
159 |
*/
|
160 |
+
|
161 |
+
if (pdf === null) {
|
162 |
+
divContainer.empty().append($('<div></div>', {'class': 'pdfemb-errormsg'}).append(msgnode = $('<span></span>').append(
|
163 |
+
document.createTextNode('Failed to load and decrypt PDF'))));
|
164 |
+
return;
|
165 |
+
}
|
166 |
+
|
167 |
PDFJS.getDocument(pdf).then(
|
168 |
function(pdfDoc_) {
|
169 |
initPdfDoc(pdfDoc_, showIsSecure)
|
178 |
divContainer.empty().append($('<div></div>', {'class': 'pdfemb-errormsg'}).append(msgnode));
|
179 |
}
|
180 |
);
|
181 |
+
|
182 |
};
|
183 |
|
184 |
if (divContainer.data('pdfDoc')) {
|
191 |
});
|
192 |
|
193 |
return this;
|
194 |
+
|
195 |
};
|
196 |
|
197 |
|
616 |
}
|
617 |
};
|
618 |
|
619 |
+
// Apply plugin to relevant divs
|
620 |
|
621 |
PDFJS.workerSrc = pdfemb_trans.worker_src;
|
622 |
PDFJS.cMapUrl = pdfemb_trans.cmap_url;
|
js/pdfjs/compatibility.min.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
"undefined"===typeof PDFJS&&(("undefined"!==typeof window?window:this).PDFJS={});
|
2 |
-
(function(){function a(a,d){return new b(this.slice(a,d))}function c(a
|
3 |
(Uint8Array.prototype.subarray=function(b,a){return new Uint8Array(this.slice(b,a))},Float32Array.prototype.subarray=function(b,a){return new Float32Array(this.slice(b,a))}),"undefined"===typeof Float64Array&&(window.Float64Array=Float32Array)):(window.Uint8Array=b,window.Int8Array=b,window.Uint32Array=b,window.Int32Array=b,window.Uint16Array=b,window.Float32Array=b,window.Float64Array=b)})();(function(){window.URL||(window.URL=window.webkitURL)})();
|
4 |
(function(){if("undefined"!==typeof Object.defineProperty){var a=!0;try{Object.defineProperty(new Image,"id",{value:"test"});var c=function(){};c.prototype={get id(){}};Object.defineProperty(new c,"id",{value:"",configurable:!0,enumerable:!0,writable:!1})}catch(b){a=!1}if(a)return}Object.defineProperty=function(b,a,c){delete b[a];"get"in c&&b.__defineGetter__(a,c.get);"set"in c&&b.__defineSetter__(a,c.set);"value"in c&&(b.__defineSetter__(a,function(b){this.__defineGetter__(a,function(){return b});
|
5 |
return b}),b[a]=c.value)}})();
|
1 |
"undefined"===typeof PDFJS&&(("undefined"!==typeof window?window:this).PDFJS={});
|
2 |
+
(function(){function a(a,d){return new b(this.slice(a,d))}function c(b,a){2>arguments.length&&(a=0);for(var c=0,g=b.length;c<g;++c,++a)this[a]=b[c]&255}function b(b){var d,e,g;if("number"===typeof b)for(d=[],e=0;e<b;++e)d[e]=0;else if("slice"in b)d=b.slice(0);else for(d=[],e=0,g=b.length;e<g;++e)d[e]=b[e];d.subarray=a;d.buffer=d;d.byteLength=d.length;d.set=c;"object"===typeof b&&b.buffer&&(d.buffer=b.buffer);return d}"undefined"!==typeof Uint8Array?("undefined"===typeof Uint8Array.prototype.subarray&&
|
3 |
(Uint8Array.prototype.subarray=function(b,a){return new Uint8Array(this.slice(b,a))},Float32Array.prototype.subarray=function(b,a){return new Float32Array(this.slice(b,a))}),"undefined"===typeof Float64Array&&(window.Float64Array=Float32Array)):(window.Uint8Array=b,window.Int8Array=b,window.Uint32Array=b,window.Int32Array=b,window.Uint16Array=b,window.Float32Array=b,window.Float64Array=b)})();(function(){window.URL||(window.URL=window.webkitURL)})();
|
4 |
(function(){if("undefined"!==typeof Object.defineProperty){var a=!0;try{Object.defineProperty(new Image,"id",{value:"test"});var c=function(){};c.prototype={get id(){}};Object.defineProperty(new c,"id",{value:"",configurable:!0,enumerable:!0,writable:!1})}catch(b){a=!1}if(a)return}Object.defineProperty=function(b,a,c){delete b[a];"get"in c&&b.__defineGetter__(a,c.get);"set"in c&&b.__defineSetter__(a,c.set);"value"in c&&(b.__defineSetter__(a,function(b){this.__defineGetter__(a,function(){return b});
|
5 |
return b}),b[a]=c.value)}})();
|
js/pdfjs/pdf.js
CHANGED
@@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {}));
|
|
28 |
// Use strict in our context only - users might not want it
|
29 |
'use strict';
|
30 |
|
31 |
-
var pdfjsVersion = '1.4.
|
32 |
-
var pdfjsBuild = '
|
33 |
|
34 |
var pdfjsFilePath =
|
35 |
typeof document !== 'undefined' && document.currentScript ?
|
@@ -699,6 +699,55 @@ function stringToBytes(str) {
|
|
699 |
return bytes;
|
700 |
}
|
701 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
702 |
function string32(value) {
|
703 |
return String.fromCharCode((value >> 24) & 0xff, (value >> 16) & 0xff,
|
704 |
(value >> 8) & 0xff, value & 0xff);
|
@@ -2483,6 +2532,8 @@ exports.UnexpectedResponseException = UnexpectedResponseException;
|
|
2483 |
exports.UnknownErrorException = UnknownErrorException;
|
2484 |
exports.Util = Util;
|
2485 |
exports.XRefParseException = XRefParseException;
|
|
|
|
|
2486 |
exports.assert = assert;
|
2487 |
exports.bytesToString = bytesToString;
|
2488 |
exports.combineUrl = combineUrl;
|
@@ -7656,15 +7707,19 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|
7656 |
}
|
7657 |
}
|
7658 |
|
7659 |
-
if
|
7660 |
-
|
7661 |
-
|
7662 |
-
|
7663 |
-
|
7664 |
-
|
7665 |
-
|
7666 |
-
|
7667 |
-
|
|
|
|
|
|
|
|
|
7668 |
}
|
7669 |
}
|
7670 |
|
28 |
// Use strict in our context only - users might not want it
|
29 |
'use strict';
|
30 |
|
31 |
+
var pdfjsVersion = '1.4.129';
|
32 |
+
var pdfjsBuild = '4065a21';
|
33 |
|
34 |
var pdfjsFilePath =
|
35 |
typeof document !== 'undefined' && document.currentScript ?
|
699 |
return bytes;
|
700 |
}
|
701 |
|
702 |
+
/**
|
703 |
+
* Gets length of the array (Array, Uint8Array, or string) in bytes.
|
704 |
+
* @param {Array|Uint8Array|string} arr
|
705 |
+
* @returns {number}
|
706 |
+
*/
|
707 |
+
function arrayByteLength(arr) {
|
708 |
+
if (arr.length !== undefined) {
|
709 |
+
return arr.length;
|
710 |
+
}
|
711 |
+
assert(arr.byteLength !== undefined);
|
712 |
+
return arr.byteLength;
|
713 |
+
}
|
714 |
+
|
715 |
+
/**
|
716 |
+
* Combines array items (arrays) into single Uint8Array object.
|
717 |
+
* @param {Array} arr - the array of the arrays (Array, Uint8Array, or string).
|
718 |
+
* @returns {Uint8Array}
|
719 |
+
*/
|
720 |
+
function arraysToBytes(arr) {
|
721 |
+
// Shortcut: if first and only item is Uint8Array, return it.
|
722 |
+
if (arr.length === 1 && (arr[0] instanceof Uint8Array)) {
|
723 |
+
return arr[0];
|
724 |
+
}
|
725 |
+
var resultLength = 0;
|
726 |
+
var i, ii = arr.length;
|
727 |
+
var item, itemLength ;
|
728 |
+
for (i = 0; i < ii; i++) {
|
729 |
+
item = arr[i];
|
730 |
+
itemLength = arrayByteLength(item);
|
731 |
+
resultLength += itemLength;
|
732 |
+
}
|
733 |
+
var pos = 0;
|
734 |
+
var data = new Uint8Array(resultLength);
|
735 |
+
for (i = 0; i < ii; i++) {
|
736 |
+
item = arr[i];
|
737 |
+
if (!(item instanceof Uint8Array)) {
|
738 |
+
if (typeof item === 'string') {
|
739 |
+
item = stringToBytes(item);
|
740 |
+
} else {
|
741 |
+
item = new Uint8Array(item);
|
742 |
+
}
|
743 |
+
}
|
744 |
+
itemLength = item.byteLength;
|
745 |
+
data.set(item, pos);
|
746 |
+
pos += itemLength;
|
747 |
+
}
|
748 |
+
return data;
|
749 |
+
}
|
750 |
+
|
751 |
function string32(value) {
|
752 |
return String.fromCharCode((value >> 24) & 0xff, (value >> 16) & 0xff,
|
753 |
(value >> 8) & 0xff, value & 0xff);
|
2532 |
exports.UnknownErrorException = UnknownErrorException;
|
2533 |
exports.Util = Util;
|
2534 |
exports.XRefParseException = XRefParseException;
|
2535 |
+
exports.arrayByteLength = arrayByteLength;
|
2536 |
+
exports.arraysToBytes = arraysToBytes;
|
2537 |
exports.assert = assert;
|
2538 |
exports.bytesToString = bytesToString;
|
2539 |
exports.combineUrl = combineUrl;
|
7707 |
}
|
7708 |
}
|
7709 |
|
7710 |
+
// Only attempt to draw the glyph if it is actually in the embedded font
|
7711 |
+
// file or if there isn't a font file so the fallback font is shown.
|
7712 |
+
if (glyph.isInFont || font.missingFile) {
|
7713 |
+
if (simpleFillText && !accent) {
|
7714 |
+
// common case
|
7715 |
+
ctx.fillText(character, scaledX, scaledY);
|
7716 |
+
} else {
|
7717 |
+
this.paintChar(character, scaledX, scaledY);
|
7718 |
+
if (accent) {
|
7719 |
+
scaledAccentX = scaledX + accent.offset.x / fontSizeScale;
|
7720 |
+
scaledAccentY = scaledY - accent.offset.y / fontSizeScale;
|
7721 |
+
this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY);
|
7722 |
+
}
|
7723 |
}
|
7724 |
}
|
7725 |
|
js/pdfjs/pdf.min.js
CHANGED
@@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {}));
|
|
28 |
// Use strict in our context only - users might not want it
|
29 |
'use strict';
|
30 |
|
31 |
-
var pdfjsVersion = '1.4.
|
32 |
-
var pdfjsBuild = '
|
33 |
|
34 |
var pdfjsFilePath =
|
35 |
typeof document !== 'undefined' && document.currentScript ?
|
@@ -699,6 +699,55 @@ function stringToBytes(str) {
|
|
699 |
return bytes;
|
700 |
}
|
701 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
702 |
function string32(value) {
|
703 |
return String.fromCharCode((value >> 24) & 0xff, (value >> 16) & 0xff,
|
704 |
(value >> 8) & 0xff, value & 0xff);
|
@@ -2483,6 +2532,8 @@ exports.UnexpectedResponseException = UnexpectedResponseException;
|
|
2483 |
exports.UnknownErrorException = UnknownErrorException;
|
2484 |
exports.Util = Util;
|
2485 |
exports.XRefParseException = XRefParseException;
|
|
|
|
|
2486 |
exports.assert = assert;
|
2487 |
exports.bytesToString = bytesToString;
|
2488 |
exports.combineUrl = combineUrl;
|
@@ -7656,15 +7707,19 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|
7656 |
}
|
7657 |
}
|
7658 |
|
7659 |
-
if
|
7660 |
-
|
7661 |
-
|
7662 |
-
|
7663 |
-
|
7664 |
-
|
7665 |
-
|
7666 |
-
|
7667 |
-
|
|
|
|
|
|
|
|
|
7668 |
}
|
7669 |
}
|
7670 |
|
28 |
// Use strict in our context only - users might not want it
|
29 |
'use strict';
|
30 |
|
31 |
+
var pdfjsVersion = '1.4.129';
|
32 |
+
var pdfjsBuild = '4065a21';
|
33 |
|
34 |
var pdfjsFilePath =
|
35 |
typeof document !== 'undefined' && document.currentScript ?
|
699 |
return bytes;
|
700 |
}
|
701 |
|
702 |
+
/**
|
703 |
+
* Gets length of the array (Array, Uint8Array, or string) in bytes.
|
704 |
+
* @param {Array|Uint8Array|string} arr
|
705 |
+
* @returns {number}
|
706 |
+
*/
|
707 |
+
function arrayByteLength(arr) {
|
708 |
+
if (arr.length !== undefined) {
|
709 |
+
return arr.length;
|
710 |
+
}
|
711 |
+
assert(arr.byteLength !== undefined);
|
712 |
+
return arr.byteLength;
|
713 |
+
}
|
714 |
+
|
715 |
+
/**
|
716 |
+
* Combines array items (arrays) into single Uint8Array object.
|
717 |
+
* @param {Array} arr - the array of the arrays (Array, Uint8Array, or string).
|
718 |
+
* @returns {Uint8Array}
|
719 |
+
*/
|
720 |
+
function arraysToBytes(arr) {
|
721 |
+
// Shortcut: if first and only item is Uint8Array, return it.
|
722 |
+
if (arr.length === 1 && (arr[0] instanceof Uint8Array)) {
|
723 |
+
return arr[0];
|
724 |
+
}
|
725 |
+
var resultLength = 0;
|
726 |
+
var i, ii = arr.length;
|
727 |
+
var item, itemLength ;
|
728 |
+
for (i = 0; i < ii; i++) {
|
729 |
+
item = arr[i];
|
730 |
+
itemLength = arrayByteLength(item);
|
731 |
+
resultLength += itemLength;
|
732 |
+
}
|
733 |
+
var pos = 0;
|
734 |
+
var data = new Uint8Array(resultLength);
|
735 |
+
for (i = 0; i < ii; i++) {
|
736 |
+
item = arr[i];
|
737 |
+
if (!(item instanceof Uint8Array)) {
|
738 |
+
if (typeof item === 'string') {
|
739 |
+
item = stringToBytes(item);
|
740 |
+
} else {
|
741 |
+
item = new Uint8Array(item);
|
742 |
+
}
|
743 |
+
}
|
744 |
+
itemLength = item.byteLength;
|
745 |
+
data.set(item, pos);
|
746 |
+
pos += itemLength;
|
747 |
+
}
|
748 |
+
return data;
|
749 |
+
}
|
750 |
+
|
751 |
function string32(value) {
|
752 |
return String.fromCharCode((value >> 24) & 0xff, (value >> 16) & 0xff,
|
753 |
(value >> 8) & 0xff, value & 0xff);
|
2532 |
exports.UnknownErrorException = UnknownErrorException;
|
2533 |
exports.Util = Util;
|
2534 |
exports.XRefParseException = XRefParseException;
|
2535 |
+
exports.arrayByteLength = arrayByteLength;
|
2536 |
+
exports.arraysToBytes = arraysToBytes;
|
2537 |
exports.assert = assert;
|
2538 |
exports.bytesToString = bytesToString;
|
2539 |
exports.combineUrl = combineUrl;
|
7707 |
}
|
7708 |
}
|
7709 |
|
7710 |
+
// Only attempt to draw the glyph if it is actually in the embedded font
|
7711 |
+
// file or if there isn't a font file so the fallback font is shown.
|
7712 |
+
if (glyph.isInFont || font.missingFile) {
|
7713 |
+
if (simpleFillText && !accent) {
|
7714 |
+
// common case
|
7715 |
+
ctx.fillText(character, scaledX, scaledY);
|
7716 |
+
} else {
|
7717 |
+
this.paintChar(character, scaledX, scaledY);
|
7718 |
+
if (accent) {
|
7719 |
+
scaledAccentX = scaledX + accent.offset.x / fontSizeScale;
|
7720 |
+
scaledAccentY = scaledY - accent.offset.y / fontSizeScale;
|
7721 |
+
this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY);
|
7722 |
+
}
|
7723 |
}
|
7724 |
}
|
7725 |
|
js/pdfjs/pdf.worker.js
CHANGED
@@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfWorker = {}));
|
|
28 |
// Use strict in our context only - users might not want it
|
29 |
'use strict';
|
30 |
|
31 |
-
var pdfjsVersion = '1.4.
|
32 |
-
var pdfjsBuild = '
|
33 |
|
34 |
var pdfjsFilePath =
|
35 |
typeof document !== 'undefined' && document.currentScript ?
|
@@ -1650,264 +1650,6 @@ exports.JpegImage = JpegImage;
|
|
1650 |
}));
|
1651 |
|
1652 |
|
1653 |
-
|
1654 |
-
|
1655 |
-
var NetworkManager = (function NetworkManagerClosure() {
|
1656 |
-
|
1657 |
-
var OK_RESPONSE = 200;
|
1658 |
-
var PARTIAL_CONTENT_RESPONSE = 206;
|
1659 |
-
|
1660 |
-
function NetworkManager(url, args) {
|
1661 |
-
this.url = url;
|
1662 |
-
args = args || {};
|
1663 |
-
this.isHttp = /^https?:/i.test(url);
|
1664 |
-
this.httpHeaders = (this.isHttp && args.httpHeaders) || {};
|
1665 |
-
this.withCredentials = args.withCredentials || false;
|
1666 |
-
this.getXhr = args.getXhr ||
|
1667 |
-
function NetworkManager_getXhr() {
|
1668 |
-
return new XMLHttpRequest();
|
1669 |
-
};
|
1670 |
-
|
1671 |
-
this.currXhrId = 0;
|
1672 |
-
this.pendingRequests = Object.create(null);
|
1673 |
-
this.loadedRequests = Object.create(null);
|
1674 |
-
}
|
1675 |
-
|
1676 |
-
function getArrayBuffer(xhr) {
|
1677 |
-
var data = xhr.response;
|
1678 |
-
if (typeof data !== 'string') {
|
1679 |
-
return data;
|
1680 |
-
}
|
1681 |
-
var length = data.length;
|
1682 |
-
var array = new Uint8Array(length);
|
1683 |
-
for (var i = 0; i < length; i++) {
|
1684 |
-
array[i] = data.charCodeAt(i) & 0xFF;
|
1685 |
-
}
|
1686 |
-
return array.buffer;
|
1687 |
-
}
|
1688 |
-
|
1689 |
-
var supportsMozChunked = (function supportsMozChunkedClosure() {
|
1690 |
-
try {
|
1691 |
-
var x = new XMLHttpRequest();
|
1692 |
-
// Firefox 37- required .open() to be called before setting responseType.
|
1693 |
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=707484
|
1694 |
-
// Even though the URL is not visited, .open() could fail if the URL is
|
1695 |
-
// blocked, e.g. via the connect-src CSP directive or the NoScript addon.
|
1696 |
-
// When this error occurs, this feature detection method will mistakenly
|
1697 |
-
// report that moz-chunked-arraybuffer is not supported in Firefox 37-.
|
1698 |
-
x.open('GET', 'https://example.com');
|
1699 |
-
x.responseType = 'moz-chunked-arraybuffer';
|
1700 |
-
return x.responseType === 'moz-chunked-arraybuffer';
|
1701 |
-
} catch (e) {
|
1702 |
-
return false;
|
1703 |
-
}
|
1704 |
-
})();
|
1705 |
-
|
1706 |
-
NetworkManager.prototype = {
|
1707 |
-
requestRange: function NetworkManager_requestRange(begin, end, listeners) {
|
1708 |
-
var args = {
|
1709 |
-
begin: begin,
|
1710 |
-
end: end
|
1711 |
-
};
|
1712 |
-
for (var prop in listeners) {
|
1713 |
-
args[prop] = listeners[prop];
|
1714 |
-
}
|
1715 |
-
return this.request(args);
|
1716 |
-
},
|
1717 |
-
|
1718 |
-
requestFull: function NetworkManager_requestFull(listeners) {
|
1719 |
-
return this.request(listeners);
|
1720 |
-
},
|
1721 |
-
|
1722 |
-
request: function NetworkManager_request(args) {
|
1723 |
-
var xhr = this.getXhr();
|
1724 |
-
var xhrId = this.currXhrId++;
|
1725 |
-
var pendingRequest = this.pendingRequests[xhrId] = {
|
1726 |
-
xhr: xhr
|
1727 |
-
};
|
1728 |
-
|
1729 |
-
xhr.open('GET', this.url);
|
1730 |
-
xhr.withCredentials = this.withCredentials;
|
1731 |
-
for (var property in this.httpHeaders) {
|
1732 |
-
var value = this.httpHeaders[property];
|
1733 |
-
if (typeof value === 'undefined') {
|
1734 |
-
continue;
|
1735 |
-
}
|
1736 |
-
xhr.setRequestHeader(property, value);
|
1737 |
-
}
|
1738 |
-
if (this.isHttp && 'begin' in args && 'end' in args) {
|
1739 |
-
var rangeStr = args.begin + '-' + (args.end - 1);
|
1740 |
-
xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
|
1741 |
-
pendingRequest.expectedStatus = 206;
|
1742 |
-
} else {
|
1743 |
-
pendingRequest.expectedStatus = 200;
|
1744 |
-
}
|
1745 |
-
|
1746 |
-
var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData;
|
1747 |
-
if (useMozChunkedLoading) {
|
1748 |
-
xhr.responseType = 'moz-chunked-arraybuffer';
|
1749 |
-
pendingRequest.onProgressiveData = args.onProgressiveData;
|
1750 |
-
pendingRequest.mozChunked = true;
|
1751 |
-
} else {
|
1752 |
-
xhr.responseType = 'arraybuffer';
|
1753 |
-
}
|
1754 |
-
|
1755 |
-
if (args.onError) {
|
1756 |
-
xhr.onerror = function(evt) {
|
1757 |
-
args.onError(xhr.status);
|
1758 |
-
};
|
1759 |
-
}
|
1760 |
-
xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
|
1761 |
-
xhr.onprogress = this.onProgress.bind(this, xhrId);
|
1762 |
-
|
1763 |
-
pendingRequest.onHeadersReceived = args.onHeadersReceived;
|
1764 |
-
pendingRequest.onDone = args.onDone;
|
1765 |
-
pendingRequest.onError = args.onError;
|
1766 |
-
pendingRequest.onProgress = args.onProgress;
|
1767 |
-
|
1768 |
-
xhr.send(null);
|
1769 |
-
|
1770 |
-
return xhrId;
|
1771 |
-
},
|
1772 |
-
|
1773 |
-
onProgress: function NetworkManager_onProgress(xhrId, evt) {
|
1774 |
-
var pendingRequest = this.pendingRequests[xhrId];
|
1775 |
-
if (!pendingRequest) {
|
1776 |
-
// Maybe abortRequest was called...
|
1777 |
-
return;
|
1778 |
-
}
|
1779 |
-
|
1780 |
-
if (pendingRequest.mozChunked) {
|
1781 |
-
var chunk = getArrayBuffer(pendingRequest.xhr);
|
1782 |
-
pendingRequest.onProgressiveData(chunk);
|
1783 |
-
}
|
1784 |
-
|
1785 |
-
var onProgress = pendingRequest.onProgress;
|
1786 |
-
if (onProgress) {
|
1787 |
-
onProgress(evt);
|
1788 |
-
}
|
1789 |
-
},
|
1790 |
-
|
1791 |
-
onStateChange: function NetworkManager_onStateChange(xhrId, evt) {
|
1792 |
-
var pendingRequest = this.pendingRequests[xhrId];
|
1793 |
-
if (!pendingRequest) {
|
1794 |
-
// Maybe abortRequest was called...
|
1795 |
-
return;
|
1796 |
-
}
|
1797 |
-
|
1798 |
-
var xhr = pendingRequest.xhr;
|
1799 |
-
if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
|
1800 |
-
pendingRequest.onHeadersReceived();
|
1801 |
-
delete pendingRequest.onHeadersReceived;
|
1802 |
-
}
|
1803 |
-
|
1804 |
-
if (xhr.readyState !== 4) {
|
1805 |
-
return;
|
1806 |
-
}
|
1807 |
-
|
1808 |
-
if (!(xhrId in this.pendingRequests)) {
|
1809 |
-
// The XHR request might have been aborted in onHeadersReceived()
|
1810 |
-
// callback, in which case we should abort request
|
1811 |
-
return;
|
1812 |
-
}
|
1813 |
-
|
1814 |
-
delete this.pendingRequests[xhrId];
|
1815 |
-
|
1816 |
-
// success status == 0 can be on ftp, file and other protocols
|
1817 |
-
if (xhr.status === 0 && this.isHttp) {
|
1818 |
-
if (pendingRequest.onError) {
|
1819 |
-
pendingRequest.onError(xhr.status);
|
1820 |
-
}
|
1821 |
-
return;
|
1822 |
-
}
|
1823 |
-
var xhrStatus = xhr.status || OK_RESPONSE;
|
1824 |
-
|
1825 |
-
// From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.2:
|
1826 |
-
// "A server MAY ignore the Range header". This means it's possible to
|
1827 |
-
// get a 200 rather than a 206 response from a range request.
|
1828 |
-
var ok_response_on_range_request =
|
1829 |
-
xhrStatus === OK_RESPONSE &&
|
1830 |
-
pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
|
1831 |
-
|
1832 |
-
if (!ok_response_on_range_request &&
|
1833 |
-
xhrStatus !== pendingRequest.expectedStatus) {
|
1834 |
-
if (pendingRequest.onError) {
|
1835 |
-
pendingRequest.onError(xhr.status);
|
1836 |
-
}
|
1837 |
-
return;
|
1838 |
-
}
|
1839 |
-
|
1840 |
-
this.loadedRequests[xhrId] = true;
|
1841 |
-
|
1842 |
-
var chunk = getArrayBuffer(xhr);
|
1843 |
-
if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
|
1844 |
-
var rangeHeader = xhr.getResponseHeader('Content-Range');
|
1845 |
-
var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
|
1846 |
-
var begin = parseInt(matches[1], 10);
|
1847 |
-
pendingRequest.onDone({
|
1848 |
-
begin: begin,
|
1849 |
-
chunk: chunk
|
1850 |
-
});
|
1851 |
-
} else if (pendingRequest.onProgressiveData) {
|
1852 |
-
pendingRequest.onDone(null);
|
1853 |
-
} else if (chunk) {
|
1854 |
-
pendingRequest.onDone({
|
1855 |
-
begin: 0,
|
1856 |
-
chunk: chunk
|
1857 |
-
});
|
1858 |
-
} else if (pendingRequest.onError) {
|
1859 |
-
pendingRequest.onError(xhr.status);
|
1860 |
-
}
|
1861 |
-
},
|
1862 |
-
|
1863 |
-
hasPendingRequests: function NetworkManager_hasPendingRequests() {
|
1864 |
-
for (var xhrId in this.pendingRequests) {
|
1865 |
-
return true;
|
1866 |
-
}
|
1867 |
-
return false;
|
1868 |
-
},
|
1869 |
-
|
1870 |
-
getRequestXhr: function NetworkManager_getXhr(xhrId) {
|
1871 |
-
return this.pendingRequests[xhrId].xhr;
|
1872 |
-
},
|
1873 |
-
|
1874 |
-
isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) {
|
1875 |
-
return !!(this.pendingRequests[xhrId].onProgressiveData);
|
1876 |
-
},
|
1877 |
-
|
1878 |
-
isPendingRequest: function NetworkManager_isPendingRequest(xhrId) {
|
1879 |
-
return xhrId in this.pendingRequests;
|
1880 |
-
},
|
1881 |
-
|
1882 |
-
isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) {
|
1883 |
-
return xhrId in this.loadedRequests;
|
1884 |
-
},
|
1885 |
-
|
1886 |
-
abortAllRequests: function NetworkManager_abortAllRequests() {
|
1887 |
-
for (var xhrId in this.pendingRequests) {
|
1888 |
-
this.abortRequest(xhrId | 0);
|
1889 |
-
}
|
1890 |
-
},
|
1891 |
-
|
1892 |
-
abortRequest: function NetworkManager_abortRequest(xhrId) {
|
1893 |
-
var xhr = this.pendingRequests[xhrId].xhr;
|
1894 |
-
delete this.pendingRequests[xhrId];
|
1895 |
-
xhr.abort();
|
1896 |
-
}
|
1897 |
-
};
|
1898 |
-
|
1899 |
-
return NetworkManager;
|
1900 |
-
})();
|
1901 |
-
|
1902 |
-
(function (root, factory) {
|
1903 |
-
{
|
1904 |
-
factory((root.pdfjsCoreNetwork = {}));
|
1905 |
-
}
|
1906 |
-
}(this, function (exports) {
|
1907 |
-
exports.NetworkManager = NetworkManager;
|
1908 |
-
}));
|
1909 |
-
|
1910 |
-
|
1911 |
(function (root, factory) {
|
1912 |
{
|
1913 |
factory((root.pdfjsSharedGlobal = {}));
|
@@ -2916,6 +2658,55 @@ function stringToBytes(str) {
|
|
2916 |
return bytes;
|
2917 |
}
|
2918 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2919 |
function string32(value) {
|
2920 |
return String.fromCharCode((value >> 24) & 0xff, (value >> 16) & 0xff,
|
2921 |
(value >> 8) & 0xff, value & 0xff);
|
@@ -4700,6 +4491,8 @@ exports.UnexpectedResponseException = UnexpectedResponseException;
|
|
4700 |
exports.UnknownErrorException = UnknownErrorException;
|
4701 |
exports.Util = Util;
|
4702 |
exports.XRefParseException = XRefParseException;
|
|
|
|
|
4703 |
exports.assert = assert;
|
4704 |
exports.bytesToString = bytesToString;
|
4705 |
exports.combineUrl = combineUrl;
|
@@ -4743,6 +4536,8 @@ exports.warn = warn;
|
|
4743 |
}(this, function (exports, sharedUtil) {
|
4744 |
|
4745 |
var MissingDataException = sharedUtil.MissingDataException;
|
|
|
|
|
4746 |
var assert = sharedUtil.assert;
|
4747 |
var createPromiseCapability = sharedUtil.createPromiseCapability;
|
4748 |
var isInt = sharedUtil.isInt;
|
@@ -4994,37 +4789,16 @@ var ChunkedStream = (function ChunkedStreamClosure() {
|
|
4994 |
|
4995 |
var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
|
4996 |
|
4997 |
-
function ChunkedStreamManager(
|
|
|
|
|
4998 |
this.stream = new ChunkedStream(length, chunkSize, this);
|
4999 |
this.length = length;
|
5000 |
this.chunkSize = chunkSize;
|
5001 |
-
this.
|
|
|
5002 |
this.disableAutoFetch = args.disableAutoFetch;
|
5003 |
-
|
5004 |
-
|
5005 |
-
if (args.chunkedViewerLoading) {
|
5006 |
-
msgHandler.on('OnDataRange', this.onReceiveData.bind(this));
|
5007 |
-
msgHandler.on('OnDataProgress', this.onProgress.bind(this));
|
5008 |
-
this.sendRequest = function ChunkedStreamManager_sendRequest(begin, end) {
|
5009 |
-
msgHandler.send('RequestDataRange', { begin: begin, end: end });
|
5010 |
-
};
|
5011 |
-
} else {
|
5012 |
-
|
5013 |
-
var getXhr = function getXhr() {
|
5014 |
-
return new XMLHttpRequest();
|
5015 |
-
};
|
5016 |
-
this.networkManager = new NetworkManager(this.url, {
|
5017 |
-
getXhr: getXhr,
|
5018 |
-
httpHeaders: args.httpHeaders,
|
5019 |
-
withCredentials: args.withCredentials
|
5020 |
-
});
|
5021 |
-
this.sendRequest = function ChunkedStreamManager_sendRequest(begin, end) {
|
5022 |
-
this.networkManager.requestRange(begin, end, {
|
5023 |
-
onDone: this.onReceiveData.bind(this),
|
5024 |
-
onProgress: this.onProgress.bind(this)
|
5025 |
-
});
|
5026 |
-
};
|
5027 |
-
}
|
5028 |
|
5029 |
this.currRequestId = 0;
|
5030 |
|
@@ -5032,12 +4806,9 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
|
|
5032 |
this.requestsByChunk = Object.create(null);
|
5033 |
this.promisesByRequest = Object.create(null);
|
5034 |
this.progressiveDataLength = 0;
|
|
|
5035 |
|
5036 |
this._loadedStreamCapability = createPromiseCapability();
|
5037 |
-
|
5038 |
-
if (args.initialData) {
|
5039 |
-
this.onReceiveData({chunk: args.initialData});
|
5040 |
-
}
|
5041 |
}
|
5042 |
|
5043 |
ChunkedStreamManager.prototype = {
|
@@ -5045,6 +4816,44 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
|
|
5045 |
return this._loadedStreamCapability.promise;
|
5046 |
},
|
5047 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5048 |
// Get all the chunks that are not yet loaded and groups them into
|
5049 |
// contiguous ranges to load in as few requests as possible
|
5050 |
requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
|
@@ -5264,8 +5073,9 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
|
|
5264 |
},
|
5265 |
|
5266 |
abort: function ChunkedStreamManager_abort() {
|
5267 |
-
|
5268 |
-
|
|
|
5269 |
}
|
5270 |
for(var requestId in this.promisesByRequest) {
|
5271 |
var capability = this.promisesByRequest[requestId];
|
@@ -26143,7 +25953,7 @@ function getFontType(type, subtype) {
|
|
26143 |
|
26144 |
var Glyph = (function GlyphClosure() {
|
26145 |
function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId,
|
26146 |
-
isSpace) {
|
26147 |
this.fontChar = fontChar;
|
26148 |
this.unicode = unicode;
|
26149 |
this.accent = accent;
|
@@ -26151,17 +25961,20 @@ var Glyph = (function GlyphClosure() {
|
|
26151 |
this.vmetric = vmetric;
|
26152 |
this.operatorListId = operatorListId;
|
26153 |
this.isSpace = isSpace;
|
|
|
26154 |
}
|
26155 |
|
26156 |
Glyph.prototype.matchesForCache = function(fontChar, unicode, accent, width,
|
26157 |
-
vmetric, operatorListId, isSpace
|
|
|
26158 |
return this.fontChar === fontChar &&
|
26159 |
this.unicode === unicode &&
|
26160 |
this.accent === accent &&
|
26161 |
this.width === width &&
|
26162 |
this.vmetric === vmetric &&
|
26163 |
this.operatorListId === operatorListId &&
|
26164 |
-
this.isSpace === isSpace
|
|
|
26165 |
};
|
26166 |
|
26167 |
return Glyph;
|
@@ -26420,6 +26233,7 @@ var Font = (function FontClosure() {
|
|
26420 |
this.loadedName = properties.loadedName;
|
26421 |
this.isType3Font = properties.isType3Font;
|
26422 |
this.sizes = [];
|
|
|
26423 |
|
26424 |
this.glyphCache = Object.create(null);
|
26425 |
|
@@ -27784,6 +27598,9 @@ var Font = (function FontClosure() {
|
|
27784 |
}
|
27785 |
for (i = 0, ii = records.length; i < ii; i++) {
|
27786 |
var record = records[i];
|
|
|
|
|
|
|
27787 |
var pos = start + stringsStart + record.offset;
|
27788 |
if (pos + record.length > end) {
|
27789 |
continue; // outside of name table, ignoring
|
@@ -28231,7 +28048,7 @@ var Font = (function FontClosure() {
|
|
28231 |
assert(cid <= 0xffff, 'Max size of CID is 65,535');
|
28232 |
var glyphId = -1;
|
28233 |
if (isCidToGidMapEmpty) {
|
28234 |
-
glyphId =
|
28235 |
} else if (cidToGidMap[cid] !== undefined) {
|
28236 |
glyphId = cidToGidMap[cid];
|
28237 |
}
|
@@ -28759,6 +28576,7 @@ var Font = (function FontClosure() {
|
|
28759 |
unicode = String.fromCharCode(unicode);
|
28760 |
}
|
28761 |
|
|
|
28762 |
// First try the toFontChar map, if it's not there then try falling
|
28763 |
// back to the char code.
|
28764 |
fontCharCode = this.toFontChar[charcode] || charcode;
|
@@ -28773,6 +28591,7 @@ var Font = (function FontClosure() {
|
|
28773 |
|
28774 |
var accent = null;
|
28775 |
if (this.seacMap && this.seacMap[charcode]) {
|
|
|
28776 |
var seac = this.seacMap[charcode];
|
28777 |
fontCharCode = seac.baseFontCharCode;
|
28778 |
accent = {
|
@@ -28786,9 +28605,9 @@ var Font = (function FontClosure() {
|
|
28786 |
var glyph = this.glyphCache[charcode];
|
28787 |
if (!glyph ||
|
28788 |
!glyph.matchesForCache(fontChar, unicode, accent, width, vmetric,
|
28789 |
-
operatorListId, isSpace)) {
|
28790 |
glyph = new Glyph(fontChar, unicode, accent, width, vmetric,
|
28791 |
-
operatorListId, isSpace);
|
28792 |
this.glyphCache[charcode] = glyph;
|
28793 |
}
|
28794 |
return glyph;
|
@@ -41567,21 +41386,18 @@ var LocalPdfManager = (function LocalPdfManagerClosure() {
|
|
41567 |
})();
|
41568 |
|
41569 |
var NetworkPdfManager = (function NetworkPdfManagerClosure() {
|
41570 |
-
function NetworkPdfManager(docId,
|
41571 |
this._docId = docId;
|
41572 |
-
this.msgHandler = msgHandler;
|
41573 |
|
41574 |
var params = {
|
41575 |
-
msgHandler: msgHandler,
|
41576 |
-
|
41577 |
-
|
41578 |
-
chunkedViewerLoading: args.chunkedViewerLoading,
|
41579 |
disableAutoFetch: args.disableAutoFetch,
|
41580 |
-
|
41581 |
};
|
41582 |
-
this.streamManager = new ChunkedStreamManager(
|
41583 |
-
args.rangeChunkSize,
|
41584 |
-
args.url, params);
|
41585 |
this.pdfDocument = new PDFDocument(this, this.streamManager.getStream(),
|
41586 |
args.password);
|
41587 |
}
|
@@ -41663,10 +41479,12 @@ var PasswordException = sharedUtil.PasswordException;
|
|
41663 |
var PasswordResponses = sharedUtil.PasswordResponses;
|
41664 |
var UnknownErrorException = sharedUtil.UnknownErrorException;
|
41665 |
var XRefParseException = sharedUtil.XRefParseException;
|
|
|
|
|
|
|
41666 |
var createPromiseCapability = sharedUtil.createPromiseCapability;
|
41667 |
var error = sharedUtil.error;
|
41668 |
var info = sharedUtil.info;
|
41669 |
-
var isInt = sharedUtil.isInt;
|
41670 |
var warn = sharedUtil.warn;
|
41671 |
var Ref = corePrimitives.Ref;
|
41672 |
var LocalPdfManager = corePdfManager.LocalPdfManager;
|
@@ -41704,6 +41522,221 @@ var WorkerTask = (function WorkerTaskClosure() {
|
|
41704 |
return WorkerTask;
|
41705 |
})();
|
41706 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41707 |
var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
41708 |
setup: function wphSetup(handler, port) {
|
41709 |
var testMessageProcessed = false;
|
@@ -41810,7 +41843,6 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
|
41810 |
var pdfManager;
|
41811 |
|
41812 |
var source = data.source;
|
41813 |
-
var disableRange = data.disableRange;
|
41814 |
if (source.data) {
|
41815 |
try {
|
41816 |
pdfManager = new LocalPdfManager(docId, source.data, source.password);
|
@@ -41819,143 +41851,113 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
|
41819 |
pdfManagerCapability.reject(ex);
|
41820 |
}
|
41821 |
return pdfManagerCapability.promise;
|
41822 |
-
}
|
41823 |
-
|
41824 |
-
|
41825 |
-
|
41826 |
-
|
41827 |
-
|
|
|
|
|
|
|
41828 |
}
|
|
|
|
|
41829 |
return pdfManagerCapability.promise;
|
41830 |
}
|
41831 |
|
41832 |
-
var
|
41833 |
-
|
41834 |
-
|
41835 |
-
|
41836 |
-
|
41837 |
-
|
41838 |
-
|
41839 |
-
|
41840 |
-
|
41841 |
-
|
41842 |
-
|
41843 |
-
|
41844 |
-
|
41845 |
-
return;
|
41846 |
-
}
|
41847 |
-
|
41848 |
-
var contentEncoding =
|
41849 |
-
fullRequestXhr.getResponseHeader('Content-Encoding') || 'identity';
|
41850 |
-
if (contentEncoding !== 'identity') {
|
41851 |
-
return;
|
41852 |
-
}
|
41853 |
|
41854 |
-
|
41855 |
-
|
41856 |
-
|
41857 |
-
return;
|
41858 |
-
}
|
41859 |
-
source.length = length;
|
41860 |
-
if (length <= 2 * source.rangeChunkSize) {
|
41861 |
-
// The file size is smaller than the size of two chunks, so it does
|
41862 |
-
// not make any sense to abort the request and retry with a range
|
41863 |
-
// request.
|
41864 |
-
return;
|
41865 |
-
}
|
41866 |
|
41867 |
-
|
41868 |
-
|
41869 |
-
|
41870 |
-
|
41871 |
-
|
41872 |
-
|
41873 |
-
|
41874 |
-
|
41875 |
-
|
41876 |
-
|
41877 |
-
|
41878 |
-
|
|
|
|
|
|
|
|
|
|
|
41879 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41880 |
try {
|
41881 |
-
|
41882 |
-
|
41883 |
-
|
41884 |
-
|
41885 |
-
|
41886 |
-
|
41887 |
-
|
41888 |
-
|
41889 |
-
onProgressiveData: source.disableStream ? null :
|
41890 |
-
function onProgressiveData(chunk) {
|
41891 |
-
if (!pdfManager) {
|
41892 |
-
cachedChunks.push(chunk);
|
41893 |
-
return;
|
41894 |
-
}
|
41895 |
-
pdfManager.sendProgressiveData(chunk);
|
41896 |
-
},
|
41897 |
-
|
41898 |
-
onDone: function onDone(args) {
|
41899 |
-
if (pdfManager) {
|
41900 |
-
return; // already processed
|
41901 |
-
}
|
41902 |
|
41903 |
-
|
41904 |
-
|
41905 |
-
|
41906 |
-
|
41907 |
-
|
41908 |
-
|
41909 |
-
|
41910 |
-
});
|
41911 |
-
if (source.length && pdfFileLength !== source.length) {
|
41912 |
-
warn('reported HTTP length is different from actual');
|
41913 |
}
|
41914 |
-
var pdfFileArray = new Uint8Array(pdfFileLength);
|
41915 |
-
cachedChunks.forEach(function (chunk) {
|
41916 |
-
pdfFileArray.set(new Uint8Array(chunk), pos);
|
41917 |
-
pos += chunk.byteLength;
|
41918 |
-
});
|
41919 |
-
pdfFile = pdfFileArray.buffer;
|
41920 |
-
} else {
|
41921 |
-
pdfFile = args.chunk;
|
41922 |
-
}
|
41923 |
|
41924 |
-
|
41925 |
-
|
41926 |
-
|
41927 |
-
|
41928 |
-
|
41929 |
-
pdfManagerCapability.reject(ex);
|
41930 |
-
}
|
41931 |
-
cancelXHRs = null;
|
41932 |
-
},
|
41933 |
|
41934 |
-
|
41935 |
-
|
41936 |
-
|
41937 |
-
exception = new MissingPDFException('Missing PDF "' +
|
41938 |
-
source.url + '".');
|
41939 |
-
handler.send('MissingPDF', exception);
|
41940 |
-
} else {
|
41941 |
-
exception = new UnexpectedResponseException(
|
41942 |
-
'Unexpected server response (' + status +
|
41943 |
-
') while retrieving PDF "' + source.url + '".', status);
|
41944 |
-
handler.send('UnexpectedResponse', exception);
|
41945 |
}
|
41946 |
-
|
41947 |
-
|
41948 |
-
|
41949 |
-
|
41950 |
-
|
41951 |
-
|
41952 |
-
total: evt.lengthComputable ? evt.total : source.length
|
41953 |
-
});
|
41954 |
-
}
|
41955 |
});
|
41956 |
|
41957 |
cancelXHRs = function () {
|
41958 |
-
|
41959 |
};
|
41960 |
|
41961 |
return pdfManagerCapability.promise;
|
@@ -42296,11 +42298,603 @@ if (typeof window === 'undefined' &&
|
|
42296 |
initializeWorker();
|
42297 |
}
|
42298 |
|
|
|
42299 |
exports.WorkerTask = WorkerTask;
|
42300 |
exports.WorkerMessageHandler = WorkerMessageHandler;
|
42301 |
}));
|
42302 |
|
42303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42304 |
}).call(pdfjsLibs);
|
42305 |
|
42306 |
exports.PDFJS = pdfjsLibs.pdfjsSharedGlobal.PDFJS;
|
28 |
// Use strict in our context only - users might not want it
|
29 |
'use strict';
|
30 |
|
31 |
+
var pdfjsVersion = '1.4.129';
|
32 |
+
var pdfjsBuild = '4065a21';
|
33 |
|
34 |
var pdfjsFilePath =
|
35 |
typeof document !== 'undefined' && document.currentScript ?
|
1650 |
}));
|
1651 |
|
1652 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1653 |
(function (root, factory) {
|
1654 |
{
|
1655 |
factory((root.pdfjsSharedGlobal = {}));
|
2658 |
return bytes;
|
2659 |
}
|
2660 |
|
2661 |
+
/**
|
2662 |
+
* Gets length of the array (Array, Uint8Array, or string) in bytes.
|
2663 |
+
* @param {Array|Uint8Array|string} arr
|
2664 |
+
* @returns {number}
|
2665 |
+
*/
|
2666 |
+
function arrayByteLength(arr) {
|
2667 |
+
if (arr.length !== undefined) {
|
2668 |
+
return arr.length;
|
2669 |
+
}
|
2670 |
+
assert(arr.byteLength !== undefined);
|
2671 |
+
return arr.byteLength;
|
2672 |
+
}
|
2673 |
+
|
2674 |
+
/**
|
2675 |
+
* Combines array items (arrays) into single Uint8Array object.
|
2676 |
+
* @param {Array} arr - the array of the arrays (Array, Uint8Array, or string).
|
2677 |
+
* @returns {Uint8Array}
|
2678 |
+
*/
|
2679 |
+
function arraysToBytes(arr) {
|
2680 |
+
// Shortcut: if first and only item is Uint8Array, return it.
|
2681 |
+
if (arr.length === 1 && (arr[0] instanceof Uint8Array)) {
|
2682 |
+
return arr[0];
|
2683 |
+
}
|
2684 |
+
var resultLength = 0;
|
2685 |
+
var i, ii = arr.length;
|
2686 |
+
var item, itemLength ;
|
2687 |
+
for (i = 0; i < ii; i++) {
|
2688 |
+
item = arr[i];
|
2689 |
+
itemLength = arrayByteLength(item);
|
2690 |
+
resultLength += itemLength;
|
2691 |
+
}
|
2692 |
+
var pos = 0;
|
2693 |
+
var data = new Uint8Array(resultLength);
|
2694 |
+
for (i = 0; i < ii; i++) {
|
2695 |
+
item = arr[i];
|
2696 |
+
if (!(item instanceof Uint8Array)) {
|
2697 |
+
if (typeof item === 'string') {
|
2698 |
+
item = stringToBytes(item);
|
2699 |
+
} else {
|
2700 |
+
item = new Uint8Array(item);
|
2701 |
+
}
|
2702 |
+
}
|
2703 |
+
itemLength = item.byteLength;
|
2704 |
+
data.set(item, pos);
|
2705 |
+
pos += itemLength;
|
2706 |
+
}
|
2707 |
+
return data;
|
2708 |
+
}
|
2709 |
+
|
2710 |
function string32(value) {
|
2711 |
return String.fromCharCode((value >> 24) & 0xff, (value >> 16) & 0xff,
|
2712 |
(value >> 8) & 0xff, value & 0xff);
|
4491 |
exports.UnknownErrorException = UnknownErrorException;
|
4492 |
exports.Util = Util;
|
4493 |
exports.XRefParseException = XRefParseException;
|
4494 |
+
exports.arrayByteLength = arrayByteLength;
|
4495 |
+
exports.arraysToBytes = arraysToBytes;
|
4496 |
exports.assert = assert;
|
4497 |
exports.bytesToString = bytesToString;
|
4498 |
exports.combineUrl = combineUrl;
|
4536 |
}(this, function (exports, sharedUtil) {
|
4537 |
|
4538 |
var MissingDataException = sharedUtil.MissingDataException;
|
4539 |
+
var arrayByteLength = sharedUtil.arrayByteLength;
|
4540 |
+
var arraysToBytes = sharedUtil.arraysToBytes;
|
4541 |
var assert = sharedUtil.assert;
|
4542 |
var createPromiseCapability = sharedUtil.createPromiseCapability;
|
4543 |
var isInt = sharedUtil.isInt;
|
4789 |
|
4790 |
var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
|
4791 |
|
4792 |
+
function ChunkedStreamManager(pdfNetworkStream, args) {
|
4793 |
+
var chunkSize = args.rangeChunkSize;
|
4794 |
+
var length = args.length;
|
4795 |
this.stream = new ChunkedStream(length, chunkSize, this);
|
4796 |
this.length = length;
|
4797 |
this.chunkSize = chunkSize;
|
4798 |
+
this.pdfNetworkStream = pdfNetworkStream;
|
4799 |
+
this.url = args.url;
|
4800 |
this.disableAutoFetch = args.disableAutoFetch;
|
4801 |
+
this.msgHandler = args.msgHandler;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4802 |
|
4803 |
this.currRequestId = 0;
|
4804 |
|
4806 |
this.requestsByChunk = Object.create(null);
|
4807 |
this.promisesByRequest = Object.create(null);
|
4808 |
this.progressiveDataLength = 0;
|
4809 |
+
this.aborted = false;
|
4810 |
|
4811 |
this._loadedStreamCapability = createPromiseCapability();
|
|
|
|
|
|
|
|
|
4812 |
}
|
4813 |
|
4814 |
ChunkedStreamManager.prototype = {
|
4816 |
return this._loadedStreamCapability.promise;
|
4817 |
},
|
4818 |
|
4819 |
+
sendRequest: function ChunkedStreamManager_sendRequest(begin, end) {
|
4820 |
+
var rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
|
4821 |
+
if (!rangeReader.isStreamingSupported) {
|
4822 |
+
rangeReader.onProgress = this.onProgress.bind(this);
|
4823 |
+
}
|
4824 |
+
var chunks = [], loaded = 0;
|
4825 |
+
var manager = this;
|
4826 |
+
var promise = new Promise(function (resolve, reject) {
|
4827 |
+
var readChunk = function (chunk) {
|
4828 |
+
try {
|
4829 |
+
if (!chunk.done) {
|
4830 |
+
var data = chunk.value;
|
4831 |
+
chunks.push(data);
|
4832 |
+
loaded += arrayByteLength(data);
|
4833 |
+
if (rangeReader.isStreamingSupported) {
|
4834 |
+
manager.onProgress({loaded: loaded});
|
4835 |
+
}
|
4836 |
+
rangeReader.read().then(readChunk, reject);
|
4837 |
+
return;
|
4838 |
+
}
|
4839 |
+
var chunkData = arraysToBytes(chunks);
|
4840 |
+
chunks = null;
|
4841 |
+
resolve(chunkData);
|
4842 |
+
} catch (e) {
|
4843 |
+
reject(e);
|
4844 |
+
}
|
4845 |
+
};
|
4846 |
+
rangeReader.read().then(readChunk, reject);
|
4847 |
+
});
|
4848 |
+
promise.then(function (data) {
|
4849 |
+
if (this.aborted) {
|
4850 |
+
return; // ignoring any data after abort
|
4851 |
+
}
|
4852 |
+
this.onReceiveData({chunk: data, begin: begin});
|
4853 |
+
}.bind(this));
|
4854 |
+
// TODO check errors
|
4855 |
+
},
|
4856 |
+
|
4857 |
// Get all the chunks that are not yet loaded and groups them into
|
4858 |
// contiguous ranges to load in as few requests as possible
|
4859 |
requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
|
5073 |
},
|
5074 |
|
5075 |
abort: function ChunkedStreamManager_abort() {
|
5076 |
+
this.aborted = true;
|
5077 |
+
if (this.pdfNetworkStream) {
|
5078 |
+
this.pdfNetworkStream.cancelAllRequests('abort');
|
5079 |
}
|
5080 |
for(var requestId in this.promisesByRequest) {
|
5081 |
var capability = this.promisesByRequest[requestId];
|
25953 |
|
25954 |
var Glyph = (function GlyphClosure() {
|
25955 |
function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId,
|
25956 |
+
isSpace, isInFont) {
|
25957 |
this.fontChar = fontChar;
|
25958 |
this.unicode = unicode;
|
25959 |
this.accent = accent;
|
25961 |
this.vmetric = vmetric;
|
25962 |
this.operatorListId = operatorListId;
|
25963 |
this.isSpace = isSpace;
|
25964 |
+
this.isInFont = isInFont;
|
25965 |
}
|
25966 |
|
25967 |
Glyph.prototype.matchesForCache = function(fontChar, unicode, accent, width,
|
25968 |
+
vmetric, operatorListId, isSpace,
|
25969 |
+
isInFont) {
|
25970 |
return this.fontChar === fontChar &&
|
25971 |
this.unicode === unicode &&
|
25972 |
this.accent === accent &&
|
25973 |
this.width === width &&
|
25974 |
this.vmetric === vmetric &&
|
25975 |
this.operatorListId === operatorListId &&
|
25976 |
+
this.isSpace === isSpace &&
|
25977 |
+
this.isInFont === isInFont;
|
25978 |
};
|
25979 |
|
25980 |
return Glyph;
|
26233 |
this.loadedName = properties.loadedName;
|
26234 |
this.isType3Font = properties.isType3Font;
|
26235 |
this.sizes = [];
|
26236 |
+
this.missingFile = false;
|
26237 |
|
26238 |
this.glyphCache = Object.create(null);
|
26239 |
|
27598 |
}
|
27599 |
for (i = 0, ii = records.length; i < ii; i++) {
|
27600 |
var record = records[i];
|
27601 |
+
if (record.length <= 0) {
|
27602 |
+
continue; // Nothing to process, ignoring.
|
27603 |
+
}
|
27604 |
var pos = start + stringsStart + record.offset;
|
27605 |
if (pos + record.length > end) {
|
27606 |
continue; // outside of name table, ignoring
|
28048 |
assert(cid <= 0xffff, 'Max size of CID is 65,535');
|
28049 |
var glyphId = -1;
|
28050 |
if (isCidToGidMapEmpty) {
|
28051 |
+
glyphId = cid;
|
28052 |
} else if (cidToGidMap[cid] !== undefined) {
|
28053 |
glyphId = cidToGidMap[cid];
|
28054 |
}
|
28576 |
unicode = String.fromCharCode(unicode);
|
28577 |
}
|
28578 |
|
28579 |
+
var isInFont = charcode in this.toFontChar;
|
28580 |
// First try the toFontChar map, if it's not there then try falling
|
28581 |
// back to the char code.
|
28582 |
fontCharCode = this.toFontChar[charcode] || charcode;
|
28591 |
|
28592 |
var accent = null;
|
28593 |
if (this.seacMap && this.seacMap[charcode]) {
|
28594 |
+
isInFont = true;
|
28595 |
var seac = this.seacMap[charcode];
|
28596 |
fontCharCode = seac.baseFontCharCode;
|
28597 |
accent = {
|
28605 |
var glyph = this.glyphCache[charcode];
|
28606 |
if (!glyph ||
|
28607 |
!glyph.matchesForCache(fontChar, unicode, accent, width, vmetric,
|
28608 |
+
operatorListId, isSpace, isInFont)) {
|
28609 |
glyph = new Glyph(fontChar, unicode, accent, width, vmetric,
|
28610 |
+
operatorListId, isSpace, isInFont);
|
28611 |
this.glyphCache[charcode] = glyph;
|
28612 |
}
|
28613 |
return glyph;
|
41386 |
})();
|
41387 |
|
41388 |
var NetworkPdfManager = (function NetworkPdfManagerClosure() {
|
41389 |
+
function NetworkPdfManager(docId, pdfNetworkStream, args) {
|
41390 |
this._docId = docId;
|
41391 |
+
this.msgHandler = args.msgHandler;
|
41392 |
|
41393 |
var params = {
|
41394 |
+
msgHandler: args.msgHandler,
|
41395 |
+
url: args.url,
|
41396 |
+
length: args.length,
|
|
|
41397 |
disableAutoFetch: args.disableAutoFetch,
|
41398 |
+
rangeChunkSize: args.rangeChunkSize
|
41399 |
};
|
41400 |
+
this.streamManager = new ChunkedStreamManager(pdfNetworkStream, params);
|
|
|
|
|
41401 |
this.pdfDocument = new PDFDocument(this, this.streamManager.getStream(),
|
41402 |
args.password);
|
41403 |
}
|
41479 |
var PasswordResponses = sharedUtil.PasswordResponses;
|
41480 |
var UnknownErrorException = sharedUtil.UnknownErrorException;
|
41481 |
var XRefParseException = sharedUtil.XRefParseException;
|
41482 |
+
var arrayByteLength = sharedUtil.arrayByteLength;
|
41483 |
+
var arraysToBytes = sharedUtil.arraysToBytes;
|
41484 |
+
var assert = sharedUtil.assert;
|
41485 |
var createPromiseCapability = sharedUtil.createPromiseCapability;
|
41486 |
var error = sharedUtil.error;
|
41487 |
var info = sharedUtil.info;
|
|
|
41488 |
var warn = sharedUtil.warn;
|
41489 |
var Ref = corePrimitives.Ref;
|
41490 |
var LocalPdfManager = corePdfManager.LocalPdfManager;
|
41522 |
return WorkerTask;
|
41523 |
})();
|
41524 |
|
41525 |
+
|
41526 |
+
/** @implements {IPDFStream} */
|
41527 |
+
var PDFWorkerStream = (function PDFWorkerStreamClosure() {
|
41528 |
+
function PDFWorkerStream(params, msgHandler) {
|
41529 |
+
this._queuedChunks = [];
|
41530 |
+
var initialData = params.initialData;
|
41531 |
+
if (initialData && initialData.length > 0) {
|
41532 |
+
this._queuedChunks.push(initialData);
|
41533 |
+
}
|
41534 |
+
this._msgHandler = msgHandler;
|
41535 |
+
|
41536 |
+
this._isRangeSupported = !(params.disableRange);
|
41537 |
+
this._isStreamingSupported = !(params.disableStream);
|
41538 |
+
this._contentLength = params.length;
|
41539 |
+
|
41540 |
+
this._fullRequestReader = null;
|
41541 |
+
this._rangeReaders = [];
|
41542 |
+
|
41543 |
+
msgHandler.on('OnDataRange', this._onReceiveData.bind(this));
|
41544 |
+
msgHandler.on('OnDataProgress', this._onProgress.bind(this));
|
41545 |
+
}
|
41546 |
+
PDFWorkerStream.prototype = {
|
41547 |
+
_onReceiveData: function PDFWorkerStream_onReceiveData(args) {
|
41548 |
+
if (args.begin === undefined) {
|
41549 |
+
if (this._fullRequestReader) {
|
41550 |
+
this._fullRequestReader._enqueue(args.chunk);
|
41551 |
+
} else {
|
41552 |
+
this._queuedChunks.push(args.chunk);
|
41553 |
+
}
|
41554 |
+
} else {
|
41555 |
+
var found = this._rangeReaders.some(function (rangeReader) {
|
41556 |
+
if (rangeReader._begin !== args.begin) {
|
41557 |
+
return false;
|
41558 |
+
}
|
41559 |
+
rangeReader._enqueue(args.chunk);
|
41560 |
+
return true;
|
41561 |
+
});
|
41562 |
+
assert(found);
|
41563 |
+
}
|
41564 |
+
},
|
41565 |
+
|
41566 |
+
_onProgress: function PDFWorkerStream_onProgress(evt) {
|
41567 |
+
if (this._rangeReaders.length > 0) {
|
41568 |
+
// Reporting to first range reader.
|
41569 |
+
var firstReader = this._rangeReaders[0];
|
41570 |
+
if (firstReader.onProgress) {
|
41571 |
+
firstReader.onProgress({loaded: evt.loaded});
|
41572 |
+
}
|
41573 |
+
}
|
41574 |
+
},
|
41575 |
+
|
41576 |
+
_removeRangeReader: function PDFWorkerStream_removeRangeReader(reader) {
|
41577 |
+
var i = this._rangeReaders.indexOf(reader);
|
41578 |
+
if (i >= 0) {
|
41579 |
+
this._rangeReaders.splice(i, 1);
|
41580 |
+
}
|
41581 |
+
},
|
41582 |
+
|
41583 |
+
getFullReader: function PDFWorkerStream_getFullReader() {
|
41584 |
+
assert(!this._fullRequestReader);
|
41585 |
+
var queuedChunks = this._queuedChunks;
|
41586 |
+
this._queuedChunks = null;
|
41587 |
+
return new PDFWorkerStreamReader(this, queuedChunks);
|
41588 |
+
},
|
41589 |
+
|
41590 |
+
getRangeReader: function PDFWorkerStream_getRangeReader(begin, end) {
|
41591 |
+
var reader = new PDFWorkerStreamRangeReader(this, begin, end);
|
41592 |
+
this._msgHandler.send('RequestDataRange', { begin: begin, end: end });
|
41593 |
+
this._rangeReaders.push(reader);
|
41594 |
+
return reader;
|
41595 |
+
},
|
41596 |
+
|
41597 |
+
cancelAllRequests: function PDFWorkerStream_cancelAllRequests(reason) {
|
41598 |
+
if (this._fullRequestReader) {
|
41599 |
+
this._fullRequestReader.cancel(reason);
|
41600 |
+
}
|
41601 |
+
var readers = this._rangeReaders.slice(0);
|
41602 |
+
readers.forEach(function (rangeReader) {
|
41603 |
+
rangeReader.cancel(reason);
|
41604 |
+
});
|
41605 |
+
}
|
41606 |
+
};
|
41607 |
+
|
41608 |
+
/** @implements {IPDFStreamReader} */
|
41609 |
+
function PDFWorkerStreamReader(stream, queuedChunks) {
|
41610 |
+
this._stream = stream;
|
41611 |
+
this._done = false;
|
41612 |
+
this._queuedChunks = queuedChunks || [];
|
41613 |
+
this._requests = [];
|
41614 |
+
this._headersReady = Promise.resolve();
|
41615 |
+
stream._fullRequestReader = this;
|
41616 |
+
|
41617 |
+
this.onProgress = null; // not used
|
41618 |
+
}
|
41619 |
+
PDFWorkerStreamReader.prototype = {
|
41620 |
+
_enqueue: function PDFWorkerStreamReader_enqueue(chunk) {
|
41621 |
+
if (this._done) {
|
41622 |
+
return; // ignore new data
|
41623 |
+
}
|
41624 |
+
if (this._requests.length > 0) {
|
41625 |
+
var requestCapability = this._requests.shift();
|
41626 |
+
requestCapability.resolve({value: chunk, done: false});
|
41627 |
+
return;
|
41628 |
+
}
|
41629 |
+
this._queuedChunks.push(chunk);
|
41630 |
+
},
|
41631 |
+
|
41632 |
+
get headersReady() {
|
41633 |
+
return this._headersReady;
|
41634 |
+
},
|
41635 |
+
|
41636 |
+
get isRangeSupported() {
|
41637 |
+
return this._stream._isRangeSupported;
|
41638 |
+
},
|
41639 |
+
|
41640 |
+
get isStreamingSupported() {
|
41641 |
+
return this._stream._isStreamingSupported;
|
41642 |
+
},
|
41643 |
+
|
41644 |
+
get contentLength() {
|
41645 |
+
return this._stream._contentLength;
|
41646 |
+
},
|
41647 |
+
|
41648 |
+
read: function PDFWorkerStreamReader_read() {
|
41649 |
+
if (this._queuedChunks.length > 0) {
|
41650 |
+
var chunk = this._queuedChunks.shift();
|
41651 |
+
return Promise.resolve({value: chunk, done: false});
|
41652 |
+
}
|
41653 |
+
if (this._done) {
|
41654 |
+
return Promise.resolve({value: undefined, done: true});
|
41655 |
+
}
|
41656 |
+
var requestCapability = createPromiseCapability();
|
41657 |
+
this._requests.push(requestCapability);
|
41658 |
+
return requestCapability.promise;
|
41659 |
+
},
|
41660 |
+
|
41661 |
+
cancel: function PDFWorkerStreamReader_cancel(reason) {
|
41662 |
+
this._done = true;
|
41663 |
+
this._requests.forEach(function (requestCapability) {
|
41664 |
+
requestCapability.resolve({value: undefined, done: true});
|
41665 |
+
});
|
41666 |
+
this._requests = [];
|
41667 |
+
}
|
41668 |
+
};
|
41669 |
+
|
41670 |
+
/** @implements {IPDFStreamRangeReader} */
|
41671 |
+
function PDFWorkerStreamRangeReader(stream, begin, end) {
|
41672 |
+
this._stream = stream;
|
41673 |
+
this._begin = begin;
|
41674 |
+
this._end = end;
|
41675 |
+
this._queuedChunk = null;
|
41676 |
+
this._requests = [];
|
41677 |
+
this._done = false;
|
41678 |
+
|
41679 |
+
this.onProgress = null;
|
41680 |
+
}
|
41681 |
+
PDFWorkerStreamRangeReader.prototype = {
|
41682 |
+
_enqueue: function PDFWorkerStreamRangeReader_enqueue(chunk) {
|
41683 |
+
if (this._done) {
|
41684 |
+
return; // ignore new data
|
41685 |
+
}
|
41686 |
+
if (this._requests.length === 0) {
|
41687 |
+
this._queuedChunk = chunk;
|
41688 |
+
} else {
|
41689 |
+
var requestsCapability = this._requests.shift();
|
41690 |
+
requestsCapability.resolve({value: chunk, done: false});
|
41691 |
+
this._requests.forEach(function (requestCapability) {
|
41692 |
+
requestCapability.resolve({value: undefined, done: true});
|
41693 |
+
});
|
41694 |
+
this._requests = [];
|
41695 |
+
}
|
41696 |
+
this._done = true;
|
41697 |
+
this._stream._removeRangeReader(this);
|
41698 |
+
},
|
41699 |
+
|
41700 |
+
get isStreamingSupported() {
|
41701 |
+
return false;
|
41702 |
+
},
|
41703 |
+
|
41704 |
+
read: function PDFWorkerStreamRangeReader_read() {
|
41705 |
+
if (this._queuedChunk) {
|
41706 |
+
return Promise.resolve({value: this._queuedChunk, done: false});
|
41707 |
+
}
|
41708 |
+
if (this._done) {
|
41709 |
+
return Promise.resolve({value: undefined, done: true});
|
41710 |
+
}
|
41711 |
+
var requestCapability = createPromiseCapability();
|
41712 |
+
this._requests.push(requestCapability);
|
41713 |
+
return requestCapability.promise;
|
41714 |
+
},
|
41715 |
+
|
41716 |
+
cancel: function PDFWorkerStreamRangeReader_cancel(reason) {
|
41717 |
+
this._done = true;
|
41718 |
+
this._requests.forEach(function (requestCapability) {
|
41719 |
+
requestCapability.resolve({value: undefined, done: true});
|
41720 |
+
});
|
41721 |
+
this._requests = [];
|
41722 |
+
this._stream._removeRangeReader(this);
|
41723 |
+
}
|
41724 |
+
};
|
41725 |
+
|
41726 |
+
return PDFWorkerStream;
|
41727 |
+
})();
|
41728 |
+
|
41729 |
+
/** @type IPDFStream */
|
41730 |
+
var PDFNetworkStream;
|
41731 |
+
|
41732 |
+
/**
|
41733 |
+
* Sets PDFNetworkStream class to be used as alternative PDF data transport.
|
41734 |
+
* @param {IPDFStream} cls - the PDF data transport.
|
41735 |
+
*/
|
41736 |
+
function setPDFNetworkStreamClass(cls) {
|
41737 |
+
PDFNetworkStream = cls;
|
41738 |
+
}
|
41739 |
+
|
41740 |
var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
41741 |
setup: function wphSetup(handler, port) {
|
41742 |
var testMessageProcessed = false;
|
41843 |
var pdfManager;
|
41844 |
|
41845 |
var source = data.source;
|
|
|
41846 |
if (source.data) {
|
41847 |
try {
|
41848 |
pdfManager = new LocalPdfManager(docId, source.data, source.password);
|
41851 |
pdfManagerCapability.reject(ex);
|
41852 |
}
|
41853 |
return pdfManagerCapability.promise;
|
41854 |
+
}
|
41855 |
+
|
41856 |
+
var pdfStream;
|
41857 |
+
try {
|
41858 |
+
if (source.chunkedViewerLoading) {
|
41859 |
+
pdfStream = new PDFWorkerStream(source, handler);
|
41860 |
+
} else {
|
41861 |
+
assert(PDFNetworkStream, 'pdfjs/core/network module is not loaded');
|
41862 |
+
pdfStream = new PDFNetworkStream(data);
|
41863 |
}
|
41864 |
+
} catch (ex) {
|
41865 |
+
pdfManagerCapability.reject(ex);
|
41866 |
return pdfManagerCapability.promise;
|
41867 |
}
|
41868 |
|
41869 |
+
var fullRequest = pdfStream.getFullReader();
|
41870 |
+
fullRequest.headersReady.then(function () {
|
41871 |
+
if (!fullRequest.isStreamingSupported ||
|
41872 |
+
!fullRequest.isRangeSupported) {
|
41873 |
+
// If stream or range are disabled, it's our only way to report
|
41874 |
+
// loading progress.
|
41875 |
+
fullRequest.onProgress = function (evt) {
|
41876 |
+
handler.send('DocProgress', {
|
41877 |
+
loaded: evt.loaded,
|
41878 |
+
total: evt.total
|
41879 |
+
});
|
41880 |
+
};
|
41881 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41882 |
|
41883 |
+
if (!fullRequest.isRangeSupported) {
|
41884 |
+
return;
|
41885 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41886 |
|
41887 |
+
// We don't need auto-fetch when streaming is enabled.
|
41888 |
+
var disableAutoFetch = source.disableAutoFetch ||
|
41889 |
+
fullRequest.isStreamingSupported;
|
41890 |
+
pdfManager = new NetworkPdfManager(docId, pdfStream, {
|
41891 |
+
msgHandler: handler,
|
41892 |
+
url: source.url,
|
41893 |
+
password: source.password,
|
41894 |
+
length: fullRequest.contentLength,
|
41895 |
+
disableAutoFetch: disableAutoFetch,
|
41896 |
+
rangeChunkSize: source.rangeChunkSize
|
41897 |
+
});
|
41898 |
+
pdfManagerCapability.resolve(pdfManager);
|
41899 |
+
cancelXHRs = null;
|
41900 |
+
}).catch(function (reason) {
|
41901 |
+
pdfManagerCapability.reject(reason);
|
41902 |
+
cancelXHRs = null;
|
41903 |
+
});
|
41904 |
|
41905 |
+
var cachedChunks = [], loaded = 0;
|
41906 |
+
var flushChunks = function () {
|
41907 |
+
var pdfFile = arraysToBytes(cachedChunks);
|
41908 |
+
if (source.length && pdfFile.length !== source.length) {
|
41909 |
+
warn('reported HTTP length is different from actual');
|
41910 |
+
}
|
41911 |
+
// the data is array, instantiating directly from it
|
41912 |
+
try {
|
41913 |
+
pdfManager = new LocalPdfManager(docId, pdfFile, source.password);
|
41914 |
+
pdfManagerCapability.resolve(pdfManager);
|
41915 |
+
} catch (ex) {
|
41916 |
+
pdfManagerCapability.reject(ex);
|
41917 |
+
}
|
41918 |
+
cachedChunks = [];
|
41919 |
+
};
|
41920 |
+
var readPromise = new Promise(function (resolve, reject) {
|
41921 |
+
var readChunk = function (chunk) {
|
41922 |
try {
|
41923 |
+
ensureNotTerminated();
|
41924 |
+
if (chunk.done) {
|
41925 |
+
if (!pdfManager) {
|
41926 |
+
flushChunks();
|
41927 |
+
}
|
41928 |
+
cancelXHRs = null;
|
41929 |
+
return;
|
41930 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41931 |
|
41932 |
+
var data = chunk.value;
|
41933 |
+
loaded += arrayByteLength(data);
|
41934 |
+
if (!fullRequest.isStreamingSupported) {
|
41935 |
+
handler.send('DocProgress', {
|
41936 |
+
loaded: loaded,
|
41937 |
+
total: Math.max(loaded, fullRequest.contentLength || 0)
|
41938 |
+
});
|
|
|
|
|
|
|
41939 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41940 |
|
41941 |
+
if (pdfManager) {
|
41942 |
+
pdfManager.sendProgressiveData(data);
|
41943 |
+
} else {
|
41944 |
+
cachedChunks.push(data);
|
41945 |
+
}
|
|
|
|
|
|
|
|
|
41946 |
|
41947 |
+
fullRequest.read().then(readChunk, reject);
|
41948 |
+
} catch (e) {
|
41949 |
+
reject(e);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41950 |
}
|
41951 |
+
};
|
41952 |
+
fullRequest.read().then(readChunk, reject);
|
41953 |
+
});
|
41954 |
+
readPromise.catch(function (e) {
|
41955 |
+
pdfManagerCapability.reject(e);
|
41956 |
+
cancelXHRs = null;
|
|
|
|
|
|
|
41957 |
});
|
41958 |
|
41959 |
cancelXHRs = function () {
|
41960 |
+
pdfStream.cancelAllRequests('abort');
|
41961 |
};
|
41962 |
|
41963 |
return pdfManagerCapability.promise;
|
42298 |
initializeWorker();
|
42299 |
}
|
42300 |
|
42301 |
+
exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass;
|
42302 |
exports.WorkerTask = WorkerTask;
|
42303 |
exports.WorkerMessageHandler = WorkerMessageHandler;
|
42304 |
}));
|
42305 |
|
42306 |
|
42307 |
+
|
42308 |
+
|
42309 |
+
var NetworkManager = (function NetworkManagerClosure() {
|
42310 |
+
|
42311 |
+
var OK_RESPONSE = 200;
|
42312 |
+
var PARTIAL_CONTENT_RESPONSE = 206;
|
42313 |
+
|
42314 |
+
function NetworkManager(url, args) {
|
42315 |
+
this.url = url;
|
42316 |
+
args = args || {};
|
42317 |
+
this.isHttp = /^https?:/i.test(url);
|
42318 |
+
this.httpHeaders = (this.isHttp && args.httpHeaders) || {};
|
42319 |
+
this.withCredentials = args.withCredentials || false;
|
42320 |
+
this.getXhr = args.getXhr ||
|
42321 |
+
function NetworkManager_getXhr() {
|
42322 |
+
return new XMLHttpRequest();
|
42323 |
+
};
|
42324 |
+
|
42325 |
+
this.currXhrId = 0;
|
42326 |
+
this.pendingRequests = Object.create(null);
|
42327 |
+
this.loadedRequests = Object.create(null);
|
42328 |
+
}
|
42329 |
+
|
42330 |
+
function getArrayBuffer(xhr) {
|
42331 |
+
var data = xhr.response;
|
42332 |
+
if (typeof data !== 'string') {
|
42333 |
+
return data;
|
42334 |
+
}
|
42335 |
+
var length = data.length;
|
42336 |
+
var array = new Uint8Array(length);
|
42337 |
+
for (var i = 0; i < length; i++) {
|
42338 |
+
array[i] = data.charCodeAt(i) & 0xFF;
|
42339 |
+
}
|
42340 |
+
return array.buffer;
|
42341 |
+
}
|
42342 |
+
|
42343 |
+
var supportsMozChunked = (function supportsMozChunkedClosure() {
|
42344 |
+
try {
|
42345 |
+
var x = new XMLHttpRequest();
|
42346 |
+
// Firefox 37- required .open() to be called before setting responseType.
|
42347 |
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=707484
|
42348 |
+
// Even though the URL is not visited, .open() could fail if the URL is
|
42349 |
+
// blocked, e.g. via the connect-src CSP directive or the NoScript addon.
|
42350 |
+
// When this error occurs, this feature detection method will mistakenly
|
42351 |
+
// report that moz-chunked-arraybuffer is not supported in Firefox 37-.
|
42352 |
+
x.open('GET', 'https://example.com');
|
42353 |
+
x.responseType = 'moz-chunked-arraybuffer';
|
42354 |
+
return x.responseType === 'moz-chunked-arraybuffer';
|
42355 |
+
} catch (e) {
|
42356 |
+
return false;
|
42357 |
+
}
|
42358 |
+
})();
|
42359 |
+
|
42360 |
+
NetworkManager.prototype = {
|
42361 |
+
requestRange: function NetworkManager_requestRange(begin, end, listeners) {
|
42362 |
+
var args = {
|
42363 |
+
begin: begin,
|
42364 |
+
end: end
|
42365 |
+
};
|
42366 |
+
for (var prop in listeners) {
|
42367 |
+
args[prop] = listeners[prop];
|
42368 |
+
}
|
42369 |
+
return this.request(args);
|
42370 |
+
},
|
42371 |
+
|
42372 |
+
requestFull: function NetworkManager_requestFull(listeners) {
|
42373 |
+
return this.request(listeners);
|
42374 |
+
},
|
42375 |
+
|
42376 |
+
request: function NetworkManager_request(args) {
|
42377 |
+
var xhr = this.getXhr();
|
42378 |
+
var xhrId = this.currXhrId++;
|
42379 |
+
var pendingRequest = this.pendingRequests[xhrId] = {
|
42380 |
+
xhr: xhr
|
42381 |
+
};
|
42382 |
+
|
42383 |
+
xhr.open('GET', this.url);
|
42384 |
+
xhr.withCredentials = this.withCredentials;
|
42385 |
+
for (var property in this.httpHeaders) {
|
42386 |
+
var value = this.httpHeaders[property];
|
42387 |
+
if (typeof value === 'undefined') {
|
42388 |
+
continue;
|
42389 |
+
}
|
42390 |
+
xhr.setRequestHeader(property, value);
|
42391 |
+
}
|
42392 |
+
if (this.isHttp && 'begin' in args && 'end' in args) {
|
42393 |
+
var rangeStr = args.begin + '-' + (args.end - 1);
|
42394 |
+
xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
|
42395 |
+
pendingRequest.expectedStatus = 206;
|
42396 |
+
} else {
|
42397 |
+
pendingRequest.expectedStatus = 200;
|
42398 |
+
}
|
42399 |
+
|
42400 |
+
var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData;
|
42401 |
+
if (useMozChunkedLoading) {
|
42402 |
+
xhr.responseType = 'moz-chunked-arraybuffer';
|
42403 |
+
pendingRequest.onProgressiveData = args.onProgressiveData;
|
42404 |
+
pendingRequest.mozChunked = true;
|
42405 |
+
} else {
|
42406 |
+
xhr.responseType = 'arraybuffer';
|
42407 |
+
}
|
42408 |
+
|
42409 |
+
if (args.onError) {
|
42410 |
+
xhr.onerror = function(evt) {
|
42411 |
+
args.onError(xhr.status);
|
42412 |
+
};
|
42413 |
+
}
|
42414 |
+
xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
|
42415 |
+
xhr.onprogress = this.onProgress.bind(this, xhrId);
|
42416 |
+
|
42417 |
+
pendingRequest.onHeadersReceived = args.onHeadersReceived;
|
42418 |
+
pendingRequest.onDone = args.onDone;
|
42419 |
+
pendingRequest.onError = args.onError;
|
42420 |
+
pendingRequest.onProgress = args.onProgress;
|
42421 |
+
|
42422 |
+
xhr.send(null);
|
42423 |
+
|
42424 |
+
return xhrId;
|
42425 |
+
},
|
42426 |
+
|
42427 |
+
onProgress: function NetworkManager_onProgress(xhrId, evt) {
|
42428 |
+
var pendingRequest = this.pendingRequests[xhrId];
|
42429 |
+
if (!pendingRequest) {
|
42430 |
+
// Maybe abortRequest was called...
|
42431 |
+
return;
|
42432 |
+
}
|
42433 |
+
|
42434 |
+
if (pendingRequest.mozChunked) {
|
42435 |
+
var chunk = getArrayBuffer(pendingRequest.xhr);
|
42436 |
+
pendingRequest.onProgressiveData(chunk);
|
42437 |
+
}
|
42438 |
+
|
42439 |
+
var onProgress = pendingRequest.onProgress;
|
42440 |
+
if (onProgress) {
|
42441 |
+
onProgress(evt);
|
42442 |
+
}
|
42443 |
+
},
|
42444 |
+
|
42445 |
+
onStateChange: function NetworkManager_onStateChange(xhrId, evt) {
|
42446 |
+
var pendingRequest = this.pendingRequests[xhrId];
|
42447 |
+
if (!pendingRequest) {
|
42448 |
+
// Maybe abortRequest was called...
|
42449 |
+
return;
|
42450 |
+
}
|
42451 |
+
|
42452 |
+
var xhr = pendingRequest.xhr;
|
42453 |
+
if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
|
42454 |
+
pendingRequest.onHeadersReceived();
|
42455 |
+
delete pendingRequest.onHeadersReceived;
|
42456 |
+
}
|
42457 |
+
|
42458 |
+
if (xhr.readyState !== 4) {
|
42459 |
+
return;
|
42460 |
+
}
|
42461 |
+
|
42462 |
+
if (!(xhrId in this.pendingRequests)) {
|
42463 |
+
// The XHR request might have been aborted in onHeadersReceived()
|
42464 |
+
// callback, in which case we should abort request
|
42465 |
+
return;
|
42466 |
+
}
|
42467 |
+
|
42468 |
+
delete this.pendingRequests[xhrId];
|
42469 |
+
|
42470 |
+
// success status == 0 can be on ftp, file and other protocols
|
42471 |
+
if (xhr.status === 0 && this.isHttp) {
|
42472 |
+
if (pendingRequest.onError) {
|
42473 |
+
pendingRequest.onError(xhr.status);
|
42474 |
+
}
|
42475 |
+
return;
|
42476 |
+
}
|
42477 |
+
var xhrStatus = xhr.status || OK_RESPONSE;
|
42478 |
+
|
42479 |
+
// From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.2:
|
42480 |
+
// "A server MAY ignore the Range header". This means it's possible to
|
42481 |
+
// get a 200 rather than a 206 response from a range request.
|
42482 |
+
var ok_response_on_range_request =
|
42483 |
+
xhrStatus === OK_RESPONSE &&
|
42484 |
+
pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
|
42485 |
+
|
42486 |
+
if (!ok_response_on_range_request &&
|
42487 |
+
xhrStatus !== pendingRequest.expectedStatus) {
|
42488 |
+
if (pendingRequest.onError) {
|
42489 |
+
pendingRequest.onError(xhr.status);
|
42490 |
+
}
|
42491 |
+
return;
|
42492 |
+
}
|
42493 |
+
|
42494 |
+
this.loadedRequests[xhrId] = true;
|
42495 |
+
|
42496 |
+
var chunk = getArrayBuffer(xhr);
|
42497 |
+
if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
|
42498 |
+
var rangeHeader = xhr.getResponseHeader('Content-Range');
|
42499 |
+
var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
|
42500 |
+
var begin = parseInt(matches[1], 10);
|
42501 |
+
pendingRequest.onDone({
|
42502 |
+
begin: begin,
|
42503 |
+
chunk: chunk
|
42504 |
+
});
|
42505 |
+
} else if (pendingRequest.onProgressiveData) {
|
42506 |
+
pendingRequest.onDone(null);
|
42507 |
+
} else if (chunk) {
|
42508 |
+
pendingRequest.onDone({
|
42509 |
+
begin: 0,
|
42510 |
+
chunk: chunk
|
42511 |
+
});
|
42512 |
+
} else if (pendingRequest.onError) {
|
42513 |
+
pendingRequest.onError(xhr.status);
|
42514 |
+
}
|
42515 |
+
},
|
42516 |
+
|
42517 |
+
hasPendingRequests: function NetworkManager_hasPendingRequests() {
|
42518 |
+
for (var xhrId in this.pendingRequests) {
|
42519 |
+
return true;
|
42520 |
+
}
|
42521 |
+
return false;
|
42522 |
+
},
|
42523 |
+
|
42524 |
+
getRequestXhr: function NetworkManager_getXhr(xhrId) {
|
42525 |
+
return this.pendingRequests[xhrId].xhr;
|
42526 |
+
},
|
42527 |
+
|
42528 |
+
isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) {
|
42529 |
+
return !!(this.pendingRequests[xhrId].onProgressiveData);
|
42530 |
+
},
|
42531 |
+
|
42532 |
+
isPendingRequest: function NetworkManager_isPendingRequest(xhrId) {
|
42533 |
+
return xhrId in this.pendingRequests;
|
42534 |
+
},
|
42535 |
+
|
42536 |
+
isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) {
|
42537 |
+
return xhrId in this.loadedRequests;
|
42538 |
+
},
|
42539 |
+
|
42540 |
+
abortAllRequests: function NetworkManager_abortAllRequests() {
|
42541 |
+
for (var xhrId in this.pendingRequests) {
|
42542 |
+
this.abortRequest(xhrId | 0);
|
42543 |
+
}
|
42544 |
+
},
|
42545 |
+
|
42546 |
+
abortRequest: function NetworkManager_abortRequest(xhrId) {
|
42547 |
+
var xhr = this.pendingRequests[xhrId].xhr;
|
42548 |
+
delete this.pendingRequests[xhrId];
|
42549 |
+
xhr.abort();
|
42550 |
+
}
|
42551 |
+
};
|
42552 |
+
|
42553 |
+
return NetworkManager;
|
42554 |
+
})();
|
42555 |
+
|
42556 |
+
(function (root, factory) {
|
42557 |
+
{
|
42558 |
+
factory((root.pdfjsCoreNetwork = {}), root.pdfjsSharedUtil,
|
42559 |
+
root.pdfjsCoreWorker);
|
42560 |
+
}
|
42561 |
+
}(this, function (exports, sharedUtil, coreWorker) {
|
42562 |
+
|
42563 |
+
var assert = sharedUtil.assert;
|
42564 |
+
var createPromiseCapability = sharedUtil.createPromiseCapability;
|
42565 |
+
var isInt = sharedUtil.isInt;
|
42566 |
+
var MissingPDFException = sharedUtil.MissingPDFException;
|
42567 |
+
var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
|
42568 |
+
|
42569 |
+
/** @implements {IPDFStream} */
|
42570 |
+
function PDFNetworkStream(options) {
|
42571 |
+
this._options = options;
|
42572 |
+
var source = options.source;
|
42573 |
+
this._manager = new NetworkManager(source.url, {
|
42574 |
+
httpHeaders: source.httpHeaders,
|
42575 |
+
withCredentials: source.withCredentials
|
42576 |
+
});
|
42577 |
+
this._rangeChunkSize = source.rangeChunkSize;
|
42578 |
+
this._fullRequestReader = null;
|
42579 |
+
this._rangeRequestReaders = [];
|
42580 |
+
}
|
42581 |
+
|
42582 |
+
PDFNetworkStream.prototype = {
|
42583 |
+
_onRangeRequestReaderClosed:
|
42584 |
+
function PDFNetworkStream_onRangeRequestReaderClosed(reader) {
|
42585 |
+
var i = this._rangeRequestReaders.indexOf(reader);
|
42586 |
+
if (i >= 0) {
|
42587 |
+
this._rangeRequestReaders.splice(i, 1);
|
42588 |
+
}
|
42589 |
+
},
|
42590 |
+
|
42591 |
+
getFullReader: function PDFNetworkStream_getFullReader() {
|
42592 |
+
assert(!this._fullRequestReader);
|
42593 |
+
this._fullRequestReader =
|
42594 |
+
new PDFNetworkStreamFullRequestReader(this._manager, this._options);
|
42595 |
+
return this._fullRequestReader;
|
42596 |
+
},
|
42597 |
+
|
42598 |
+
getRangeReader: function PDFNetworkStream_getRangeReader(begin, end) {
|
42599 |
+
var reader = new PDFNetworkStreamRangeRequestReader(this._manager,
|
42600 |
+
begin, end);
|
42601 |
+
reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
|
42602 |
+
this._rangeRequestReaders.push(reader);
|
42603 |
+
return reader;
|
42604 |
+
},
|
42605 |
+
|
42606 |
+
cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) {
|
42607 |
+
if (this._fullRequestReader) {
|
42608 |
+
this._fullRequestReader.cancel(reason);
|
42609 |
+
}
|
42610 |
+
var readers = this._rangeRequestReaders.slice(0);
|
42611 |
+
readers.forEach(function (reader) {
|
42612 |
+
reader.cancel(reason);
|
42613 |
+
});
|
42614 |
+
}
|
42615 |
+
};
|
42616 |
+
|
42617 |
+
/** @implements {IPDFStreamReader} */
|
42618 |
+
function PDFNetworkStreamFullRequestReader(manager, options) {
|
42619 |
+
this._manager = manager;
|
42620 |
+
|
42621 |
+
var source = options.source;
|
42622 |
+
var args = {
|
42623 |
+
onHeadersReceived: this._onHeadersReceived.bind(this),
|
42624 |
+
onProgressiveData: source.disableStream ? null :
|
42625 |
+
this._onProgressiveData.bind(this),
|
42626 |
+
onDone: this._onDone.bind(this),
|
42627 |
+
onError: this._onError.bind(this),
|
42628 |
+
onProgress: this._onProgress.bind(this)
|
42629 |
+
};
|
42630 |
+
this._url = source.url;
|
42631 |
+
this._fullRequestId = manager.requestFull(args);
|
42632 |
+
this._headersReceivedCapability = createPromiseCapability();
|
42633 |
+
this._disableRange = options.disableRange || false;
|
42634 |
+
this._contentLength = source.length; // optional
|
42635 |
+
this._rangeChunkSize = source.rangeChunkSize;
|
42636 |
+
if (!this._rangeChunkSize && !this._disableRange) {
|
42637 |
+
this._disableRange = true;
|
42638 |
+
}
|
42639 |
+
|
42640 |
+
this._isStreamingSupported = false;
|
42641 |
+
this._isRangeSupported = false;
|
42642 |
+
|
42643 |
+
this._cachedChunks = [];
|
42644 |
+
this._requests = [];
|
42645 |
+
this._done = false;
|
42646 |
+
this._storedError = undefined;
|
42647 |
+
|
42648 |
+
this.onProgress = null;
|
42649 |
+
}
|
42650 |
+
|
42651 |
+
PDFNetworkStreamFullRequestReader.prototype = {
|
42652 |
+
_validateRangeRequestCapabilities: function
|
42653 |
+
PDFNetworkStreamFullRequestReader_validateRangeRequestCapabilities() {
|
42654 |
+
|
42655 |
+
if (this._disableRange) {
|
42656 |
+
return false;
|
42657 |
+
}
|
42658 |
+
|
42659 |
+
var networkManager = this._manager;
|
42660 |
+
var fullRequestXhrId = this._fullRequestId;
|
42661 |
+
var fullRequestXhr = networkManager.getRequestXhr(fullRequestXhrId);
|
42662 |
+
if (fullRequestXhr.getResponseHeader('Accept-Ranges') !== 'bytes') {
|
42663 |
+
return false;
|
42664 |
+
}
|
42665 |
+
|
42666 |
+
var contentEncoding =
|
42667 |
+
fullRequestXhr.getResponseHeader('Content-Encoding') || 'identity';
|
42668 |
+
if (contentEncoding !== 'identity') {
|
42669 |
+
return false;
|
42670 |
+
}
|
42671 |
+
|
42672 |
+
var length = fullRequestXhr.getResponseHeader('Content-Length');
|
42673 |
+
length = parseInt(length, 10);
|
42674 |
+
if (!isInt(length)) {
|
42675 |
+
return false;
|
42676 |
+
}
|
42677 |
+
|
42678 |
+
this._contentLength = length; // setting right content length
|
42679 |
+
|
42680 |
+
if (length <= 2 * this._rangeChunkSize) {
|
42681 |
+
// The file size is smaller than the size of two chunks, so it does
|
42682 |
+
// not make any sense to abort the request and retry with a range
|
42683 |
+
// request.
|
42684 |
+
return false;
|
42685 |
+
}
|
42686 |
+
|
42687 |
+
return true;
|
42688 |
+
},
|
42689 |
+
|
42690 |
+
_onHeadersReceived:
|
42691 |
+
function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
|
42692 |
+
|
42693 |
+
if (this._validateRangeRequestCapabilities()) {
|
42694 |
+
this._isRangeSupported = true;
|
42695 |
+
}
|
42696 |
+
|
42697 |
+
var networkManager = this._manager;
|
42698 |
+
var fullRequestXhrId = this._fullRequestId;
|
42699 |
+
if (networkManager.isStreamingRequest(fullRequestXhrId)) {
|
42700 |
+
// We can continue fetching when progressive loading is enabled,
|
42701 |
+
// and we don't need the autoFetch feature.
|
42702 |
+
this._isStreamingSupported = true;
|
42703 |
+
} else if (this._isRangeSupported) {
|
42704 |
+
// NOTE: by cancelling the full request, and then issuing range
|
42705 |
+
// requests, there will be an issue for sites where you can only
|
42706 |
+
// request the pdf once. However, if this is the case, then the
|
42707 |
+
// server should not be returning that it can support range
|
42708 |
+
// requests.
|
42709 |
+
networkManager.abortRequest(fullRequestXhrId);
|
42710 |
+
}
|
42711 |
+
|
42712 |
+
this._headersReceivedCapability.resolve();
|
42713 |
+
},
|
42714 |
+
|
42715 |
+
_onProgressiveData:
|
42716 |
+
function PDFNetworkStreamFullRequestReader_onProgressiveData(chunk) {
|
42717 |
+
if (this._requests.length > 0) {
|
42718 |
+
var requestCapability = this._requests.shift();
|
42719 |
+
requestCapability.resolve({value: chunk, done: false});
|
42720 |
+
} else {
|
42721 |
+
this._cachedChunks.push(chunk);
|
42722 |
+
}
|
42723 |
+
},
|
42724 |
+
|
42725 |
+
_onDone: function PDFNetworkStreamFullRequestReader_onDone(args) {
|
42726 |
+
if (args) {
|
42727 |
+
this._onProgressiveData(args.chunk);
|
42728 |
+
}
|
42729 |
+
this._done = true;
|
42730 |
+
if (this._cachedChunks.length > 0) {
|
42731 |
+
return;
|
42732 |
+
}
|
42733 |
+
this._requests.forEach(function (requestCapability) {
|
42734 |
+
requestCapability.resolve({value: undefined, done: true});
|
42735 |
+
});
|
42736 |
+
this._requests = [];
|
42737 |
+
},
|
42738 |
+
|
42739 |
+
_onError: function PDFNetworkStreamFullRequestReader_onError(status) {
|
42740 |
+
var url = this._url;
|
42741 |
+
var exception;
|
42742 |
+
if (status === 404 || status === 0 && /^file:/.test(url)) {
|
42743 |
+
exception = new MissingPDFException('Missing PDF "' + url + '".');
|
42744 |
+
} else {
|
42745 |
+
exception = new UnexpectedResponseException(
|
42746 |
+
'Unexpected server response (' + status +
|
42747 |
+
') while retrieving PDF "' + url + '".', status);
|
42748 |
+
}
|
42749 |
+
this._storedError = exception;
|
42750 |
+
this._headersReceivedCapability.reject(exception);
|
42751 |
+
this._requests.forEach(function (requestCapability) {
|
42752 |
+
requestCapability.reject(exception);
|
42753 |
+
});
|
42754 |
+
this._requests = [];
|
42755 |
+
this._cachedChunks = [];
|
42756 |
+
},
|
42757 |
+
|
42758 |
+
_onProgress: function PDFNetworkStreamFullRequestReader_onProgress(data) {
|
42759 |
+
if (this.onProgress) {
|
42760 |
+
this.onProgress({
|
42761 |
+
loaded: data.loaded,
|
42762 |
+
total: data.lengthComputable ? data.total : this._contentLength
|
42763 |
+
});
|
42764 |
+
}
|
42765 |
+
},
|
42766 |
+
|
42767 |
+
get isRangeSupported() {
|
42768 |
+
return this._isRangeSupported;
|
42769 |
+
},
|
42770 |
+
|
42771 |
+
get isStreamingSupported() {
|
42772 |
+
return this._isStreamingSupported;
|
42773 |
+
},
|
42774 |
+
|
42775 |
+
get contentLength() {
|
42776 |
+
return this._contentLength;
|
42777 |
+
},
|
42778 |
+
|
42779 |
+
get headersReady() {
|
42780 |
+
return this._headersReceivedCapability.promise;
|
42781 |
+
},
|
42782 |
+
|
42783 |
+
read: function PDFNetworkStreamFullRequestReader_read() {
|
42784 |
+
if (this._storedError) {
|
42785 |
+
return Promise.reject(this._storedError);
|
42786 |
+
}
|
42787 |
+
if (this._cachedChunks.length > 0) {
|
42788 |
+
var chunk = this._cachedChunks.shift();
|
42789 |
+
return Promise.resolve(chunk);
|
42790 |
+
}
|
42791 |
+
if (this._done) {
|
42792 |
+
return Promise.resolve({value: undefined, done: true});
|
42793 |
+
}
|
42794 |
+
var requestCapability = createPromiseCapability();
|
42795 |
+
this._requests.push(requestCapability);
|
42796 |
+
return requestCapability.promise;
|
42797 |
+
},
|
42798 |
+
|
42799 |
+
cancel: function PDFNetworkStreamFullRequestReader_cancel(reason) {
|
42800 |
+
this._done = true;
|
42801 |
+
this._headersReceivedCapability.reject(reason);
|
42802 |
+
this._requests.forEach(function (requestCapability) {
|
42803 |
+
requestCapability.resolve({value: undefined, done: true});
|
42804 |
+
});
|
42805 |
+
this._requests = [];
|
42806 |
+
if (this._manager.isPendingRequest(this._fullRequestId)) {
|
42807 |
+
this._manager.abortRequest(this._fullRequestId);
|
42808 |
+
}
|
42809 |
+
this._fullRequestReader = null;
|
42810 |
+
}
|
42811 |
+
};
|
42812 |
+
|
42813 |
+
/** @implements {IPDFStreamRangeReader} */
|
42814 |
+
function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
|
42815 |
+
this._manager = manager;
|
42816 |
+
var args = {
|
42817 |
+
onDone: this._onDone.bind(this),
|
42818 |
+
onProgress: this._onProgress.bind(this)
|
42819 |
+
};
|
42820 |
+
this._requestId = manager.requestRange(begin, end, args);
|
42821 |
+
this._requests = [];
|
42822 |
+
this._queuedChunk = null;
|
42823 |
+
this._done = false;
|
42824 |
+
|
42825 |
+
this.onProgress = null;
|
42826 |
+
this.onClosed = null;
|
42827 |
+
}
|
42828 |
+
|
42829 |
+
PDFNetworkStreamRangeRequestReader.prototype = {
|
42830 |
+
_close: function PDFNetworkStreamRangeRequestReader_close() {
|
42831 |
+
if (this.onClosed) {
|
42832 |
+
this.onClosed(this);
|
42833 |
+
}
|
42834 |
+
},
|
42835 |
+
|
42836 |
+
_onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) {
|
42837 |
+
var chunk = data.chunk;
|
42838 |
+
if (this._requests.length > 0) {
|
42839 |
+
var requestCapability = this._requests.shift();
|
42840 |
+
requestCapability.resolve({value: chunk, done: false});
|
42841 |
+
} else {
|
42842 |
+
this._queuedChunk = chunk;
|
42843 |
+
}
|
42844 |
+
this._done = true;
|
42845 |
+
this._requests.forEach(function (requestCapability) {
|
42846 |
+
requestCapability.resolve({value: undefined, done: true});
|
42847 |
+
});
|
42848 |
+
this._requests = [];
|
42849 |
+
this._close();
|
42850 |
+
},
|
42851 |
+
|
42852 |
+
_onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) {
|
42853 |
+
if (!this.isStreamingSupported && this.onProgress) {
|
42854 |
+
this.onProgress({
|
42855 |
+
loaded: evt.loaded
|
42856 |
+
});
|
42857 |
+
}
|
42858 |
+
},
|
42859 |
+
|
42860 |
+
get isStreamingSupported() {
|
42861 |
+
return false; // TODO allow progressive range bytes loading
|
42862 |
+
},
|
42863 |
+
|
42864 |
+
read: function PDFNetworkStreamRangeRequestReader_read() {
|
42865 |
+
if (this._queuedChunk !== null) {
|
42866 |
+
var chunk = this._queuedChunk;
|
42867 |
+
this._queuedChunk = null;
|
42868 |
+
return Promise.resolve({value: chunk, done: false});
|
42869 |
+
}
|
42870 |
+
if (this._done) {
|
42871 |
+
return Promise.resolve({value: undefined, done: true});
|
42872 |
+
}
|
42873 |
+
var requestCapability = createPromiseCapability();
|
42874 |
+
this._requests.push(requestCapability);
|
42875 |
+
return requestCapability.promise;
|
42876 |
+
},
|
42877 |
+
|
42878 |
+
cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) {
|
42879 |
+
this._done = true;
|
42880 |
+
this._requests.forEach(function (requestCapability) {
|
42881 |
+
requestCapability.resolve({value: undefined, done: true});
|
42882 |
+
});
|
42883 |
+
this._requests = [];
|
42884 |
+
if (this._manager.isPendingRequest(this._requestId)) {
|
42885 |
+
this._manager.abortRequest(this._requestId);
|
42886 |
+
}
|
42887 |
+
this._close();
|
42888 |
+
}
|
42889 |
+
};
|
42890 |
+
|
42891 |
+
coreWorker.setPDFNetworkStreamClass(PDFNetworkStream);
|
42892 |
+
|
42893 |
+
exports.PDFNetworkStream = PDFNetworkStream;
|
42894 |
+
exports.NetworkManager = NetworkManager;
|
42895 |
+
}));
|
42896 |
+
|
42897 |
+
|
42898 |
}).call(pdfjsLibs);
|
42899 |
|
42900 |
exports.PDFJS = pdfjsLibs.pdfjsSharedGlobal.PDFJS;
|
js/pdfjs/pdf.worker.min.js
CHANGED
@@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfWorker = {}));
|
|
28 |
// Use strict in our context only - users might not want it
|
29 |
'use strict';
|
30 |
|
31 |
-
var pdfjsVersion = '1.4.
|
32 |
-
var pdfjsBuild = '
|
33 |
|
34 |
var pdfjsFilePath =
|
35 |
typeof document !== 'undefined' && document.currentScript ?
|
@@ -1650,264 +1650,6 @@ exports.JpegImage = JpegImage;
|
|
1650 |
}));
|
1651 |
|
1652 |
|
1653 |
-
|
1654 |
-
|
1655 |
-
var NetworkManager = (function NetworkManagerClosure() {
|
1656 |
-
|
1657 |
-
var OK_RESPONSE = 200;
|
1658 |
-
var PARTIAL_CONTENT_RESPONSE = 206;
|
1659 |
-
|
1660 |
-
function NetworkManager(url, args) {
|
1661 |
-
this.url = url;
|
1662 |
-
args = args || {};
|
1663 |
-
this.isHttp = /^https?:/i.test(url);
|
1664 |
-
this.httpHeaders = (this.isHttp && args.httpHeaders) || {};
|
1665 |
-
this.withCredentials = args.withCredentials || false;
|
1666 |
-
this.getXhr = args.getXhr ||
|
1667 |
-
function NetworkManager_getXhr() {
|
1668 |
-
return new XMLHttpRequest();
|
1669 |
-
};
|
1670 |
-
|
1671 |
-
this.currXhrId = 0;
|
1672 |
-
this.pendingRequests = Object.create(null);
|
1673 |
-
this.loadedRequests = Object.create(null);
|
1674 |
-
}
|
1675 |
-
|
1676 |
-
function getArrayBuffer(xhr) {
|
1677 |
-
var data = xhr.response;
|
1678 |
-
if (typeof data !== 'string') {
|
1679 |
-
return data;
|
1680 |
-
}
|
1681 |
-
var length = data.length;
|
1682 |
-
var array = new Uint8Array(length);
|
1683 |
-
for (var i = 0; i < length; i++) {
|
1684 |
-
array[i] = data.charCodeAt(i) & 0xFF;
|
1685 |
-
}
|
1686 |
-
return array.buffer;
|
1687 |
-
}
|
1688 |
-
|
1689 |
-
var supportsMozChunked = (function supportsMozChunkedClosure() {
|
1690 |
-
try {
|
1691 |
-
var x = new XMLHttpRequest();
|
1692 |
-
// Firefox 37- required .open() to be called before setting responseType.
|
1693 |
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=707484
|
1694 |
-
// Even though the URL is not visited, .open() could fail if the URL is
|
1695 |
-
// blocked, e.g. via the connect-src CSP directive or the NoScript addon.
|
1696 |
-
// When this error occurs, this feature detection method will mistakenly
|
1697 |
-
// report that moz-chunked-arraybuffer is not supported in Firefox 37-.
|
1698 |
-
x.open('GET', 'https://example.com');
|
1699 |
-
x.responseType = 'moz-chunked-arraybuffer';
|
1700 |
-
return x.responseType === 'moz-chunked-arraybuffer';
|
1701 |
-
} catch (e) {
|
1702 |
-
return false;
|
1703 |
-
}
|
1704 |
-
})();
|
1705 |
-
|
1706 |
-
NetworkManager.prototype = {
|
1707 |
-
requestRange: function NetworkManager_requestRange(begin, end, listeners) {
|
1708 |
-
var args = {
|
1709 |
-
begin: begin,
|
1710 |
-
end: end
|
1711 |
-
};
|
1712 |
-
for (var prop in listeners) {
|
1713 |
-
args[prop] = listeners[prop];
|
1714 |
-
}
|
1715 |
-
return this.request(args);
|
1716 |
-
},
|
1717 |
-
|
1718 |
-
requestFull: function NetworkManager_requestFull(listeners) {
|
1719 |
-
return this.request(listeners);
|
1720 |
-
},
|
1721 |
-
|
1722 |
-
request: function NetworkManager_request(args) {
|
1723 |
-
var xhr = this.getXhr();
|
1724 |
-
var xhrId = this.currXhrId++;
|
1725 |
-
var pendingRequest = this.pendingRequests[xhrId] = {
|
1726 |
-
xhr: xhr
|
1727 |
-
};
|
1728 |
-
|
1729 |
-
xhr.open('GET', this.url);
|
1730 |
-
xhr.withCredentials = this.withCredentials;
|
1731 |
-
for (var property in this.httpHeaders) {
|
1732 |
-
var value = this.httpHeaders[property];
|
1733 |
-
if (typeof value === 'undefined') {
|
1734 |
-
continue;
|
1735 |
-
}
|
1736 |
-
xhr.setRequestHeader(property, value);
|
1737 |
-
}
|
1738 |
-
if (this.isHttp && 'begin' in args && 'end' in args) {
|
1739 |
-
var rangeStr = args.begin + '-' + (args.end - 1);
|
1740 |
-
xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
|
1741 |
-
pendingRequest.expectedStatus = 206;
|
1742 |
-
} else {
|
1743 |
-
pendingRequest.expectedStatus = 200;
|
1744 |
-
}
|
1745 |
-
|
1746 |
-
var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData;
|
1747 |
-
if (useMozChunkedLoading) {
|
1748 |
-
xhr.responseType = 'moz-chunked-arraybuffer';
|
1749 |
-
pendingRequest.onProgressiveData = args.onProgressiveData;
|
1750 |
-
pendingRequest.mozChunked = true;
|
1751 |
-
} else {
|
1752 |
-
xhr.responseType = 'arraybuffer';
|
1753 |
-
}
|
1754 |
-
|
1755 |
-
if (args.onError) {
|
1756 |
-
xhr.onerror = function(evt) {
|
1757 |
-
args.onError(xhr.status);
|
1758 |
-
};
|
1759 |
-
}
|
1760 |
-
xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
|
1761 |
-
xhr.onprogress = this.onProgress.bind(this, xhrId);
|
1762 |
-
|
1763 |
-
pendingRequest.onHeadersReceived = args.onHeadersReceived;
|
1764 |
-
pendingRequest.onDone = args.onDone;
|
1765 |
-
pendingRequest.onError = args.onError;
|
1766 |
-
pendingRequest.onProgress = args.onProgress;
|
1767 |
-
|
1768 |
-
xhr.send(null);
|
1769 |
-
|
1770 |
-
return xhrId;
|
1771 |
-
},
|
1772 |
-
|
1773 |
-
onProgress: function NetworkManager_onProgress(xhrId, evt) {
|
1774 |
-
var pendingRequest = this.pendingRequests[xhrId];
|
1775 |
-
if (!pendingRequest) {
|
1776 |
-
// Maybe abortRequest was called...
|
1777 |
-
return;
|
1778 |
-
}
|
1779 |
-
|
1780 |
-
if (pendingRequest.mozChunked) {
|
1781 |
-
var chunk = getArrayBuffer(pendingRequest.xhr);
|
1782 |
-
pendingRequest.onProgressiveData(chunk);
|
1783 |
-
}
|
1784 |
-
|
1785 |
-
var onProgress = pendingRequest.onProgress;
|
1786 |
-
if (onProgress) {
|
1787 |
-
onProgress(evt);
|
1788 |
-
}
|
1789 |
-
},
|
1790 |
-
|
1791 |
-
onStateChange: function NetworkManager_onStateChange(xhrId, evt) {
|
1792 |
-
var pendingRequest = this.pendingRequests[xhrId];
|
1793 |
-
if (!pendingRequest) {
|
1794 |
-
// Maybe abortRequest was called...
|
1795 |
-
return;
|
1796 |
-
}
|
1797 |
-
|
1798 |
-
var xhr = pendingRequest.xhr;
|
1799 |
-
if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
|
1800 |
-
pendingRequest.onHeadersReceived();
|
1801 |
-
delete pendingRequest.onHeadersReceived;
|
1802 |
-
}
|
1803 |
-
|
1804 |
-
if (xhr.readyState !== 4) {
|
1805 |
-
return;
|
1806 |
-
}
|
1807 |
-
|
1808 |
-
if (!(xhrId in this.pendingRequests)) {
|
1809 |
-
// The XHR request might have been aborted in onHeadersReceived()
|
1810 |
-
// callback, in which case we should abort request
|
1811 |
-
return;
|
1812 |
-
}
|
1813 |
-
|
1814 |
-
delete this.pendingRequests[xhrId];
|
1815 |
-
|
1816 |
-
// success status == 0 can be on ftp, file and other protocols
|
1817 |
-
if (xhr.status === 0 && this.isHttp) {
|
1818 |
-
if (pendingRequest.onError) {
|
1819 |
-
pendingRequest.onError(xhr.status);
|
1820 |
-
}
|
1821 |
-
return;
|
1822 |
-
}
|
1823 |
-
var xhrStatus = xhr.status || OK_RESPONSE;
|
1824 |
-
|
1825 |
-
// From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.2:
|
1826 |
-
// "A server MAY ignore the Range header". This means it's possible to
|
1827 |
-
// get a 200 rather than a 206 response from a range request.
|
1828 |
-
var ok_response_on_range_request =
|
1829 |
-
xhrStatus === OK_RESPONSE &&
|
1830 |
-
pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
|
1831 |
-
|
1832 |
-
if (!ok_response_on_range_request &&
|
1833 |
-
xhrStatus !== pendingRequest.expectedStatus) {
|
1834 |
-
if (pendingRequest.onError) {
|
1835 |
-
pendingRequest.onError(xhr.status);
|
1836 |
-
}
|
1837 |
-
return;
|
1838 |
-
}
|
1839 |
-
|
1840 |
-
this.loadedRequests[xhrId] = true;
|
1841 |
-
|
1842 |
-
var chunk = getArrayBuffer(xhr);
|
1843 |
-
if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
|
1844 |
-
var rangeHeader = xhr.getResponseHeader('Content-Range');
|
1845 |
-
var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
|
1846 |
-
var begin = parseInt(matches[1], 10);
|
1847 |
-
pendingRequest.onDone({
|
1848 |
-
begin: begin,
|
1849 |
-
chunk: chunk
|
1850 |
-
});
|
1851 |
-
} else if (pendingRequest.onProgressiveData) {
|
1852 |
-
pendingRequest.onDone(null);
|
1853 |
-
} else if (chunk) {
|
1854 |
-
pendingRequest.onDone({
|
1855 |
-
begin: 0,
|
1856 |
-
chunk: chunk
|
1857 |
-
});
|
1858 |
-
} else if (pendingRequest.onError) {
|
1859 |
-
pendingRequest.onError(xhr.status);
|
1860 |
-
}
|
1861 |
-
},
|
1862 |
-
|
1863 |
-
hasPendingRequests: function NetworkManager_hasPendingRequests() {
|
1864 |
-
for (var xhrId in this.pendingRequests) {
|
1865 |
-
return true;
|
1866 |
-
}
|
1867 |
-
return false;
|
1868 |
-
},
|
1869 |
-
|
1870 |
-
getRequestXhr: function NetworkManager_getXhr(xhrId) {
|
1871 |
-
return this.pendingRequests[xhrId].xhr;
|
1872 |
-
},
|
1873 |
-
|
1874 |
-
isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) {
|
1875 |
-
return !!(this.pendingRequests[xhrId].onProgressiveData);
|
1876 |
-
},
|
1877 |
-
|
1878 |
-
isPendingRequest: function NetworkManager_isPendingRequest(xhrId) {
|
1879 |
-
return xhrId in this.pendingRequests;
|
1880 |
-
},
|
1881 |
-
|
1882 |
-
isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) {
|
1883 |
-
return xhrId in this.loadedRequests;
|
1884 |
-
},
|
1885 |
-
|
1886 |
-
abortAllRequests: function NetworkManager_abortAllRequests() {
|
1887 |
-
for (var xhrId in this.pendingRequests) {
|
1888 |
-
this.abortRequest(xhrId | 0);
|
1889 |
-
}
|
1890 |
-
},
|
1891 |
-
|
1892 |
-
abortRequest: function NetworkManager_abortRequest(xhrId) {
|
1893 |
-
var xhr = this.pendingRequests[xhrId].xhr;
|
1894 |
-
delete this.pendingRequests[xhrId];
|
1895 |
-
xhr.abort();
|
1896 |
-
}
|
1897 |
-
};
|
1898 |
-
|
1899 |
-
return NetworkManager;
|
1900 |
-
})();
|
1901 |
-
|
1902 |
-
(function (root, factory) {
|
1903 |
-
{
|
1904 |
-
factory((root.pdfjsCoreNetwork = {}));
|
1905 |
-
}
|
1906 |
-
}(this, function (exports) {
|
1907 |
-
exports.NetworkManager = NetworkManager;
|
1908 |
-
}));
|
1909 |
-
|
1910 |
-
|
1911 |
(function (root, factory) {
|
1912 |
{
|
1913 |
factory((root.pdfjsSharedGlobal = {}));
|
@@ -2916,6 +2658,55 @@ function stringToBytes(str) {
|
|
2916 |
return bytes;
|
2917 |
}
|
2918 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2919 |
function string32(value) {
|
2920 |
return String.fromCharCode((value >> 24) & 0xff, (value >> 16) & 0xff,
|
2921 |
(value >> 8) & 0xff, value & 0xff);
|
@@ -4700,6 +4491,8 @@ exports.UnexpectedResponseException = UnexpectedResponseException;
|
|
4700 |
exports.UnknownErrorException = UnknownErrorException;
|
4701 |
exports.Util = Util;
|
4702 |
exports.XRefParseException = XRefParseException;
|
|
|
|
|
4703 |
exports.assert = assert;
|
4704 |
exports.bytesToString = bytesToString;
|
4705 |
exports.combineUrl = combineUrl;
|
@@ -4743,6 +4536,8 @@ exports.warn = warn;
|
|
4743 |
}(this, function (exports, sharedUtil) {
|
4744 |
|
4745 |
var MissingDataException = sharedUtil.MissingDataException;
|
|
|
|
|
4746 |
var assert = sharedUtil.assert;
|
4747 |
var createPromiseCapability = sharedUtil.createPromiseCapability;
|
4748 |
var isInt = sharedUtil.isInt;
|
@@ -4994,37 +4789,16 @@ var ChunkedStream = (function ChunkedStreamClosure() {
|
|
4994 |
|
4995 |
var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
|
4996 |
|
4997 |
-
function ChunkedStreamManager(
|
|
|
|
|
4998 |
this.stream = new ChunkedStream(length, chunkSize, this);
|
4999 |
this.length = length;
|
5000 |
this.chunkSize = chunkSize;
|
5001 |
-
this.
|
|
|
5002 |
this.disableAutoFetch = args.disableAutoFetch;
|
5003 |
-
|
5004 |
-
|
5005 |
-
if (args.chunkedViewerLoading) {
|
5006 |
-
msgHandler.on('OnDataRange', this.onReceiveData.bind(this));
|
5007 |
-
msgHandler.on('OnDataProgress', this.onProgress.bind(this));
|
5008 |
-
this.sendRequest = function ChunkedStreamManager_sendRequest(begin, end) {
|
5009 |
-
msgHandler.send('RequestDataRange', { begin: begin, end: end });
|
5010 |
-
};
|
5011 |
-
} else {
|
5012 |
-
|
5013 |
-
var getXhr = function getXhr() {
|
5014 |
-
return new XMLHttpRequest();
|
5015 |
-
};
|
5016 |
-
this.networkManager = new NetworkManager(this.url, {
|
5017 |
-
getXhr: getXhr,
|
5018 |
-
httpHeaders: args.httpHeaders,
|
5019 |
-
withCredentials: args.withCredentials
|
5020 |
-
});
|
5021 |
-
this.sendRequest = function ChunkedStreamManager_sendRequest(begin, end) {
|
5022 |
-
this.networkManager.requestRange(begin, end, {
|
5023 |
-
onDone: this.onReceiveData.bind(this),
|
5024 |
-
onProgress: this.onProgress.bind(this)
|
5025 |
-
});
|
5026 |
-
};
|
5027 |
-
}
|
5028 |
|
5029 |
this.currRequestId = 0;
|
5030 |
|
@@ -5032,12 +4806,9 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
|
|
5032 |
this.requestsByChunk = Object.create(null);
|
5033 |
this.promisesByRequest = Object.create(null);
|
5034 |
this.progressiveDataLength = 0;
|
|
|
5035 |
|
5036 |
this._loadedStreamCapability = createPromiseCapability();
|
5037 |
-
|
5038 |
-
if (args.initialData) {
|
5039 |
-
this.onReceiveData({chunk: args.initialData});
|
5040 |
-
}
|
5041 |
}
|
5042 |
|
5043 |
ChunkedStreamManager.prototype = {
|
@@ -5045,6 +4816,44 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
|
|
5045 |
return this._loadedStreamCapability.promise;
|
5046 |
},
|
5047 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5048 |
// Get all the chunks that are not yet loaded and groups them into
|
5049 |
// contiguous ranges to load in as few requests as possible
|
5050 |
requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
|
@@ -5264,8 +5073,9 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
|
|
5264 |
},
|
5265 |
|
5266 |
abort: function ChunkedStreamManager_abort() {
|
5267 |
-
|
5268 |
-
|
|
|
5269 |
}
|
5270 |
for(var requestId in this.promisesByRequest) {
|
5271 |
var capability = this.promisesByRequest[requestId];
|
@@ -26143,7 +25953,7 @@ function getFontType(type, subtype) {
|
|
26143 |
|
26144 |
var Glyph = (function GlyphClosure() {
|
26145 |
function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId,
|
26146 |
-
isSpace) {
|
26147 |
this.fontChar = fontChar;
|
26148 |
this.unicode = unicode;
|
26149 |
this.accent = accent;
|
@@ -26151,17 +25961,20 @@ var Glyph = (function GlyphClosure() {
|
|
26151 |
this.vmetric = vmetric;
|
26152 |
this.operatorListId = operatorListId;
|
26153 |
this.isSpace = isSpace;
|
|
|
26154 |
}
|
26155 |
|
26156 |
Glyph.prototype.matchesForCache = function(fontChar, unicode, accent, width,
|
26157 |
-
vmetric, operatorListId, isSpace
|
|
|
26158 |
return this.fontChar === fontChar &&
|
26159 |
this.unicode === unicode &&
|
26160 |
this.accent === accent &&
|
26161 |
this.width === width &&
|
26162 |
this.vmetric === vmetric &&
|
26163 |
this.operatorListId === operatorListId &&
|
26164 |
-
this.isSpace === isSpace
|
|
|
26165 |
};
|
26166 |
|
26167 |
return Glyph;
|
@@ -26420,6 +26233,7 @@ var Font = (function FontClosure() {
|
|
26420 |
this.loadedName = properties.loadedName;
|
26421 |
this.isType3Font = properties.isType3Font;
|
26422 |
this.sizes = [];
|
|
|
26423 |
|
26424 |
this.glyphCache = Object.create(null);
|
26425 |
|
@@ -27784,6 +27598,9 @@ var Font = (function FontClosure() {
|
|
27784 |
}
|
27785 |
for (i = 0, ii = records.length; i < ii; i++) {
|
27786 |
var record = records[i];
|
|
|
|
|
|
|
27787 |
var pos = start + stringsStart + record.offset;
|
27788 |
if (pos + record.length > end) {
|
27789 |
continue; // outside of name table, ignoring
|
@@ -28231,7 +28048,7 @@ var Font = (function FontClosure() {
|
|
28231 |
assert(cid <= 0xffff, 'Max size of CID is 65,535');
|
28232 |
var glyphId = -1;
|
28233 |
if (isCidToGidMapEmpty) {
|
28234 |
-
glyphId =
|
28235 |
} else if (cidToGidMap[cid] !== undefined) {
|
28236 |
glyphId = cidToGidMap[cid];
|
28237 |
}
|
@@ -28759,6 +28576,7 @@ var Font = (function FontClosure() {
|
|
28759 |
unicode = String.fromCharCode(unicode);
|
28760 |
}
|
28761 |
|
|
|
28762 |
// First try the toFontChar map, if it's not there then try falling
|
28763 |
// back to the char code.
|
28764 |
fontCharCode = this.toFontChar[charcode] || charcode;
|
@@ -28773,6 +28591,7 @@ var Font = (function FontClosure() {
|
|
28773 |
|
28774 |
var accent = null;
|
28775 |
if (this.seacMap && this.seacMap[charcode]) {
|
|
|
28776 |
var seac = this.seacMap[charcode];
|
28777 |
fontCharCode = seac.baseFontCharCode;
|
28778 |
accent = {
|
@@ -28786,9 +28605,9 @@ var Font = (function FontClosure() {
|
|
28786 |
var glyph = this.glyphCache[charcode];
|
28787 |
if (!glyph ||
|
28788 |
!glyph.matchesForCache(fontChar, unicode, accent, width, vmetric,
|
28789 |
-
operatorListId, isSpace)) {
|
28790 |
glyph = new Glyph(fontChar, unicode, accent, width, vmetric,
|
28791 |
-
operatorListId, isSpace);
|
28792 |
this.glyphCache[charcode] = glyph;
|
28793 |
}
|
28794 |
return glyph;
|
@@ -41567,21 +41386,18 @@ var LocalPdfManager = (function LocalPdfManagerClosure() {
|
|
41567 |
})();
|
41568 |
|
41569 |
var NetworkPdfManager = (function NetworkPdfManagerClosure() {
|
41570 |
-
function NetworkPdfManager(docId,
|
41571 |
this._docId = docId;
|
41572 |
-
this.msgHandler = msgHandler;
|
41573 |
|
41574 |
var params = {
|
41575 |
-
msgHandler: msgHandler,
|
41576 |
-
|
41577 |
-
|
41578 |
-
chunkedViewerLoading: args.chunkedViewerLoading,
|
41579 |
disableAutoFetch: args.disableAutoFetch,
|
41580 |
-
|
41581 |
};
|
41582 |
-
this.streamManager = new ChunkedStreamManager(
|
41583 |
-
args.rangeChunkSize,
|
41584 |
-
args.url, params);
|
41585 |
this.pdfDocument = new PDFDocument(this, this.streamManager.getStream(),
|
41586 |
args.password);
|
41587 |
}
|
@@ -41663,10 +41479,12 @@ var PasswordException = sharedUtil.PasswordException;
|
|
41663 |
var PasswordResponses = sharedUtil.PasswordResponses;
|
41664 |
var UnknownErrorException = sharedUtil.UnknownErrorException;
|
41665 |
var XRefParseException = sharedUtil.XRefParseException;
|
|
|
|
|
|
|
41666 |
var createPromiseCapability = sharedUtil.createPromiseCapability;
|
41667 |
var error = sharedUtil.error;
|
41668 |
var info = sharedUtil.info;
|
41669 |
-
var isInt = sharedUtil.isInt;
|
41670 |
var warn = sharedUtil.warn;
|
41671 |
var Ref = corePrimitives.Ref;
|
41672 |
var LocalPdfManager = corePdfManager.LocalPdfManager;
|
@@ -41704,6 +41522,221 @@ var WorkerTask = (function WorkerTaskClosure() {
|
|
41704 |
return WorkerTask;
|
41705 |
})();
|
41706 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41707 |
var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
41708 |
setup: function wphSetup(handler, port) {
|
41709 |
var testMessageProcessed = false;
|
@@ -41810,7 +41843,6 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
|
41810 |
var pdfManager;
|
41811 |
|
41812 |
var source = data.source;
|
41813 |
-
var disableRange = data.disableRange;
|
41814 |
if (source.data) {
|
41815 |
try {
|
41816 |
pdfManager = new LocalPdfManager(docId, source.data, source.password);
|
@@ -41819,143 +41851,113 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
|
41819 |
pdfManagerCapability.reject(ex);
|
41820 |
}
|
41821 |
return pdfManagerCapability.promise;
|
41822 |
-
}
|
41823 |
-
|
41824 |
-
|
41825 |
-
|
41826 |
-
|
41827 |
-
|
|
|
|
|
|
|
41828 |
}
|
|
|
|
|
41829 |
return pdfManagerCapability.promise;
|
41830 |
}
|
41831 |
|
41832 |
-
var
|
41833 |
-
|
41834 |
-
|
41835 |
-
|
41836 |
-
|
41837 |
-
|
41838 |
-
|
41839 |
-
|
41840 |
-
|
41841 |
-
|
41842 |
-
|
41843 |
-
|
41844 |
-
|
41845 |
-
return;
|
41846 |
-
}
|
41847 |
-
|
41848 |
-
var contentEncoding =
|
41849 |
-
fullRequestXhr.getResponseHeader('Content-Encoding') || 'identity';
|
41850 |
-
if (contentEncoding !== 'identity') {
|
41851 |
-
return;
|
41852 |
-
}
|
41853 |
|
41854 |
-
|
41855 |
-
|
41856 |
-
|
41857 |
-
return;
|
41858 |
-
}
|
41859 |
-
source.length = length;
|
41860 |
-
if (length <= 2 * source.rangeChunkSize) {
|
41861 |
-
// The file size is smaller than the size of two chunks, so it does
|
41862 |
-
// not make any sense to abort the request and retry with a range
|
41863 |
-
// request.
|
41864 |
-
return;
|
41865 |
-
}
|
41866 |
|
41867 |
-
|
41868 |
-
|
41869 |
-
|
41870 |
-
|
41871 |
-
|
41872 |
-
|
41873 |
-
|
41874 |
-
|
41875 |
-
|
41876 |
-
|
41877 |
-
|
41878 |
-
|
|
|
|
|
|
|
|
|
|
|
41879 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41880 |
try {
|
41881 |
-
|
41882 |
-
|
41883 |
-
|
41884 |
-
|
41885 |
-
|
41886 |
-
|
41887 |
-
|
41888 |
-
|
41889 |
-
onProgressiveData: source.disableStream ? null :
|
41890 |
-
function onProgressiveData(chunk) {
|
41891 |
-
if (!pdfManager) {
|
41892 |
-
cachedChunks.push(chunk);
|
41893 |
-
return;
|
41894 |
-
}
|
41895 |
-
pdfManager.sendProgressiveData(chunk);
|
41896 |
-
},
|
41897 |
-
|
41898 |
-
onDone: function onDone(args) {
|
41899 |
-
if (pdfManager) {
|
41900 |
-
return; // already processed
|
41901 |
-
}
|
41902 |
|
41903 |
-
|
41904 |
-
|
41905 |
-
|
41906 |
-
|
41907 |
-
|
41908 |
-
|
41909 |
-
|
41910 |
-
});
|
41911 |
-
if (source.length && pdfFileLength !== source.length) {
|
41912 |
-
warn('reported HTTP length is different from actual');
|
41913 |
}
|
41914 |
-
var pdfFileArray = new Uint8Array(pdfFileLength);
|
41915 |
-
cachedChunks.forEach(function (chunk) {
|
41916 |
-
pdfFileArray.set(new Uint8Array(chunk), pos);
|
41917 |
-
pos += chunk.byteLength;
|
41918 |
-
});
|
41919 |
-
pdfFile = pdfFileArray.buffer;
|
41920 |
-
} else {
|
41921 |
-
pdfFile = args.chunk;
|
41922 |
-
}
|
41923 |
|
41924 |
-
|
41925 |
-
|
41926 |
-
|
41927 |
-
|
41928 |
-
|
41929 |
-
pdfManagerCapability.reject(ex);
|
41930 |
-
}
|
41931 |
-
cancelXHRs = null;
|
41932 |
-
},
|
41933 |
|
41934 |
-
|
41935 |
-
|
41936 |
-
|
41937 |
-
exception = new MissingPDFException('Missing PDF "' +
|
41938 |
-
source.url + '".');
|
41939 |
-
handler.send('MissingPDF', exception);
|
41940 |
-
} else {
|
41941 |
-
exception = new UnexpectedResponseException(
|
41942 |
-
'Unexpected server response (' + status +
|
41943 |
-
') while retrieving PDF "' + source.url + '".', status);
|
41944 |
-
handler.send('UnexpectedResponse', exception);
|
41945 |
}
|
41946 |
-
|
41947 |
-
|
41948 |
-
|
41949 |
-
|
41950 |
-
|
41951 |
-
|
41952 |
-
total: evt.lengthComputable ? evt.total : source.length
|
41953 |
-
});
|
41954 |
-
}
|
41955 |
});
|
41956 |
|
41957 |
cancelXHRs = function () {
|
41958 |
-
|
41959 |
};
|
41960 |
|
41961 |
return pdfManagerCapability.promise;
|
@@ -42296,11 +42298,603 @@ if (typeof window === 'undefined' &&
|
|
42296 |
initializeWorker();
|
42297 |
}
|
42298 |
|
|
|
42299 |
exports.WorkerTask = WorkerTask;
|
42300 |
exports.WorkerMessageHandler = WorkerMessageHandler;
|
42301 |
}));
|
42302 |
|
42303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42304 |
}).call(pdfjsLibs);
|
42305 |
|
42306 |
exports.PDFJS = pdfjsLibs.pdfjsSharedGlobal.PDFJS;
|
28 |
// Use strict in our context only - users might not want it
|
29 |
'use strict';
|
30 |
|
31 |
+
var pdfjsVersion = '1.4.129';
|
32 |
+
var pdfjsBuild = '4065a21';
|
33 |
|
34 |
var pdfjsFilePath =
|
35 |
typeof document !== 'undefined' && document.currentScript ?
|
1650 |
}));
|
1651 |
|
1652 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1653 |
(function (root, factory) {
|
1654 |
{
|
1655 |
factory((root.pdfjsSharedGlobal = {}));
|
2658 |
return bytes;
|
2659 |
}
|
2660 |
|
2661 |
+
/**
|
2662 |
+
* Gets length of the array (Array, Uint8Array, or string) in bytes.
|
2663 |
+
* @param {Array|Uint8Array|string} arr
|
2664 |
+
* @returns {number}
|
2665 |
+
*/
|
2666 |
+
function arrayByteLength(arr) {
|
2667 |
+
if (arr.length !== undefined) {
|
2668 |
+
return arr.length;
|
2669 |
+
}
|
2670 |
+
assert(arr.byteLength !== undefined);
|
2671 |
+
return arr.byteLength;
|
2672 |
+
}
|
2673 |
+
|
2674 |
+
/**
|
2675 |
+
* Combines array items (arrays) into single Uint8Array object.
|
2676 |
+
* @param {Array} arr - the array of the arrays (Array, Uint8Array, or string).
|
2677 |
+
* @returns {Uint8Array}
|
2678 |
+
*/
|
2679 |
+
function arraysToBytes(arr) {
|
2680 |
+
// Shortcut: if first and only item is Uint8Array, return it.
|
2681 |
+
if (arr.length === 1 && (arr[0] instanceof Uint8Array)) {
|
2682 |
+
return arr[0];
|
2683 |
+
}
|
2684 |
+
var resultLength = 0;
|
2685 |
+
var i, ii = arr.length;
|
2686 |
+
var item, itemLength ;
|
2687 |
+
for (i = 0; i < ii; i++) {
|
2688 |
+
item = arr[i];
|
2689 |
+
itemLength = arrayByteLength(item);
|
2690 |
+
resultLength += itemLength;
|
2691 |
+
}
|
2692 |
+
var pos = 0;
|
2693 |
+
var data = new Uint8Array(resultLength);
|
2694 |
+
for (i = 0; i < ii; i++) {
|
2695 |
+
item = arr[i];
|
2696 |
+
if (!(item instanceof Uint8Array)) {
|
2697 |
+
if (typeof item === 'string') {
|
2698 |
+
item = stringToBytes(item);
|
2699 |
+
} else {
|
2700 |
+
item = new Uint8Array(item);
|
2701 |
+
}
|
2702 |
+
}
|
2703 |
+
itemLength = item.byteLength;
|
2704 |
+
data.set(item, pos);
|
2705 |
+
pos += itemLength;
|
2706 |
+
}
|
2707 |
+
return data;
|
2708 |
+
}
|
2709 |
+
|
2710 |
function string32(value) {
|
2711 |
return String.fromCharCode((value >> 24) & 0xff, (value >> 16) & 0xff,
|
2712 |
(value >> 8) & 0xff, value & 0xff);
|
4491 |
exports.UnknownErrorException = UnknownErrorException;
|
4492 |
exports.Util = Util;
|
4493 |
exports.XRefParseException = XRefParseException;
|
4494 |
+
exports.arrayByteLength = arrayByteLength;
|
4495 |
+
exports.arraysToBytes = arraysToBytes;
|
4496 |
exports.assert = assert;
|
4497 |
exports.bytesToString = bytesToString;
|
4498 |
exports.combineUrl = combineUrl;
|
4536 |
}(this, function (exports, sharedUtil) {
|
4537 |
|
4538 |
var MissingDataException = sharedUtil.MissingDataException;
|
4539 |
+
var arrayByteLength = sharedUtil.arrayByteLength;
|
4540 |
+
var arraysToBytes = sharedUtil.arraysToBytes;
|
4541 |
var assert = sharedUtil.assert;
|
4542 |
var createPromiseCapability = sharedUtil.createPromiseCapability;
|
4543 |
var isInt = sharedUtil.isInt;
|
4789 |
|
4790 |
var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
|
4791 |
|
4792 |
+
function ChunkedStreamManager(pdfNetworkStream, args) {
|
4793 |
+
var chunkSize = args.rangeChunkSize;
|
4794 |
+
var length = args.length;
|
4795 |
this.stream = new ChunkedStream(length, chunkSize, this);
|
4796 |
this.length = length;
|
4797 |
this.chunkSize = chunkSize;
|
4798 |
+
this.pdfNetworkStream = pdfNetworkStream;
|
4799 |
+
this.url = args.url;
|
4800 |
this.disableAutoFetch = args.disableAutoFetch;
|
4801 |
+
this.msgHandler = args.msgHandler;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4802 |
|
4803 |
this.currRequestId = 0;
|
4804 |
|
4806 |
this.requestsByChunk = Object.create(null);
|
4807 |
this.promisesByRequest = Object.create(null);
|
4808 |
this.progressiveDataLength = 0;
|
4809 |
+
this.aborted = false;
|
4810 |
|
4811 |
this._loadedStreamCapability = createPromiseCapability();
|
|
|
|
|
|
|
|
|
4812 |
}
|
4813 |
|
4814 |
ChunkedStreamManager.prototype = {
|
4816 |
return this._loadedStreamCapability.promise;
|
4817 |
},
|
4818 |
|
4819 |
+
sendRequest: function ChunkedStreamManager_sendRequest(begin, end) {
|
4820 |
+
var rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
|
4821 |
+
if (!rangeReader.isStreamingSupported) {
|
4822 |
+
rangeReader.onProgress = this.onProgress.bind(this);
|
4823 |
+
}
|
4824 |
+
var chunks = [], loaded = 0;
|
4825 |
+
var manager = this;
|
4826 |
+
var promise = new Promise(function (resolve, reject) {
|
4827 |
+
var readChunk = function (chunk) {
|
4828 |
+
try {
|
4829 |
+
if (!chunk.done) {
|
4830 |
+
var data = chunk.value;
|
4831 |
+
chunks.push(data);
|
4832 |
+
loaded += arrayByteLength(data);
|
4833 |
+
if (rangeReader.isStreamingSupported) {
|
4834 |
+
manager.onProgress({loaded: loaded});
|
4835 |
+
}
|
4836 |
+
rangeReader.read().then(readChunk, reject);
|
4837 |
+
return;
|
4838 |
+
}
|
4839 |
+
var chunkData = arraysToBytes(chunks);
|
4840 |
+
chunks = null;
|
4841 |
+
resolve(chunkData);
|
4842 |
+
} catch (e) {
|
4843 |
+
reject(e);
|
4844 |
+
}
|
4845 |
+
};
|
4846 |
+
rangeReader.read().then(readChunk, reject);
|
4847 |
+
});
|
4848 |
+
promise.then(function (data) {
|
4849 |
+
if (this.aborted) {
|
4850 |
+
return; // ignoring any data after abort
|
4851 |
+
}
|
4852 |
+
this.onReceiveData({chunk: data, begin: begin});
|
4853 |
+
}.bind(this));
|
4854 |
+
// TODO check errors
|
4855 |
+
},
|
4856 |
+
|
4857 |
// Get all the chunks that are not yet loaded and groups them into
|
4858 |
// contiguous ranges to load in as few requests as possible
|
4859 |
requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
|
5073 |
},
|
5074 |
|
5075 |
abort: function ChunkedStreamManager_abort() {
|
5076 |
+
this.aborted = true;
|
5077 |
+
if (this.pdfNetworkStream) {
|
5078 |
+
this.pdfNetworkStream.cancelAllRequests('abort');
|
5079 |
}
|
5080 |
for(var requestId in this.promisesByRequest) {
|
5081 |
var capability = this.promisesByRequest[requestId];
|
25953 |
|
25954 |
var Glyph = (function GlyphClosure() {
|
25955 |
function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId,
|
25956 |
+
isSpace, isInFont) {
|
25957 |
this.fontChar = fontChar;
|
25958 |
this.unicode = unicode;
|
25959 |
this.accent = accent;
|
25961 |
this.vmetric = vmetric;
|
25962 |
this.operatorListId = operatorListId;
|
25963 |
this.isSpace = isSpace;
|
25964 |
+
this.isInFont = isInFont;
|
25965 |
}
|
25966 |
|
25967 |
Glyph.prototype.matchesForCache = function(fontChar, unicode, accent, width,
|
25968 |
+
vmetric, operatorListId, isSpace,
|
25969 |
+
isInFont) {
|
25970 |
return this.fontChar === fontChar &&
|
25971 |
this.unicode === unicode &&
|
25972 |
this.accent === accent &&
|
25973 |
this.width === width &&
|
25974 |
this.vmetric === vmetric &&
|
25975 |
this.operatorListId === operatorListId &&
|
25976 |
+
this.isSpace === isSpace &&
|
25977 |
+
this.isInFont === isInFont;
|
25978 |
};
|
25979 |
|
25980 |
return Glyph;
|
26233 |
this.loadedName = properties.loadedName;
|
26234 |
this.isType3Font = properties.isType3Font;
|
26235 |
this.sizes = [];
|
26236 |
+
this.missingFile = false;
|
26237 |
|
26238 |
this.glyphCache = Object.create(null);
|
26239 |
|
27598 |
}
|
27599 |
for (i = 0, ii = records.length; i < ii; i++) {
|
27600 |
var record = records[i];
|
27601 |
+
if (record.length <= 0) {
|
27602 |
+
continue; // Nothing to process, ignoring.
|
27603 |
+
}
|
27604 |
var pos = start + stringsStart + record.offset;
|
27605 |
if (pos + record.length > end) {
|
27606 |
continue; // outside of name table, ignoring
|
28048 |
assert(cid <= 0xffff, 'Max size of CID is 65,535');
|
28049 |
var glyphId = -1;
|
28050 |
if (isCidToGidMapEmpty) {
|
28051 |
+
glyphId = cid;
|
28052 |
} else if (cidToGidMap[cid] !== undefined) {
|
28053 |
glyphId = cidToGidMap[cid];
|
28054 |
}
|
28576 |
unicode = String.fromCharCode(unicode);
|
28577 |
}
|
28578 |
|
28579 |
+
var isInFont = charcode in this.toFontChar;
|
28580 |
// First try the toFontChar map, if it's not there then try falling
|
28581 |
// back to the char code.
|
28582 |
fontCharCode = this.toFontChar[charcode] || charcode;
|
28591 |
|
28592 |
var accent = null;
|
28593 |
if (this.seacMap && this.seacMap[charcode]) {
|
28594 |
+
isInFont = true;
|
28595 |
var seac = this.seacMap[charcode];
|
28596 |
fontCharCode = seac.baseFontCharCode;
|
28597 |
accent = {
|
28605 |
var glyph = this.glyphCache[charcode];
|
28606 |
if (!glyph ||
|
28607 |
!glyph.matchesForCache(fontChar, unicode, accent, width, vmetric,
|
28608 |
+
operatorListId, isSpace, isInFont)) {
|
28609 |
glyph = new Glyph(fontChar, unicode, accent, width, vmetric,
|
28610 |
+
operatorListId, isSpace, isInFont);
|
28611 |
this.glyphCache[charcode] = glyph;
|
28612 |
}
|
28613 |
return glyph;
|
41386 |
})();
|
41387 |
|
41388 |
var NetworkPdfManager = (function NetworkPdfManagerClosure() {
|
41389 |
+
function NetworkPdfManager(docId, pdfNetworkStream, args) {
|
41390 |
this._docId = docId;
|
41391 |
+
this.msgHandler = args.msgHandler;
|
41392 |
|
41393 |
var params = {
|
41394 |
+
msgHandler: args.msgHandler,
|
41395 |
+
url: args.url,
|
41396 |
+
length: args.length,
|
|
|
41397 |
disableAutoFetch: args.disableAutoFetch,
|
41398 |
+
rangeChunkSize: args.rangeChunkSize
|
41399 |
};
|
41400 |
+
this.streamManager = new ChunkedStreamManager(pdfNetworkStream, params);
|
|
|
|
|
41401 |
this.pdfDocument = new PDFDocument(this, this.streamManager.getStream(),
|
41402 |
args.password);
|
41403 |
}
|
41479 |
var PasswordResponses = sharedUtil.PasswordResponses;
|
41480 |
var UnknownErrorException = sharedUtil.UnknownErrorException;
|
41481 |
var XRefParseException = sharedUtil.XRefParseException;
|
41482 |
+
var arrayByteLength = sharedUtil.arrayByteLength;
|
41483 |
+
var arraysToBytes = sharedUtil.arraysToBytes;
|
41484 |
+
var assert = sharedUtil.assert;
|
41485 |
var createPromiseCapability = sharedUtil.createPromiseCapability;
|
41486 |
var error = sharedUtil.error;
|
41487 |
var info = sharedUtil.info;
|
|
|
41488 |
var warn = sharedUtil.warn;
|
41489 |
var Ref = corePrimitives.Ref;
|
41490 |
var LocalPdfManager = corePdfManager.LocalPdfManager;
|
41522 |
return WorkerTask;
|
41523 |
})();
|
41524 |
|
41525 |
+
|
41526 |
+
/** @implements {IPDFStream} */
|
41527 |
+
var PDFWorkerStream = (function PDFWorkerStreamClosure() {
|
41528 |
+
function PDFWorkerStream(params, msgHandler) {
|
41529 |
+
this._queuedChunks = [];
|
41530 |
+
var initialData = params.initialData;
|
41531 |
+
if (initialData && initialData.length > 0) {
|
41532 |
+
this._queuedChunks.push(initialData);
|
41533 |
+
}
|
41534 |
+
this._msgHandler = msgHandler;
|
41535 |
+
|
41536 |
+
this._isRangeSupported = !(params.disableRange);
|
41537 |
+
this._isStreamingSupported = !(params.disableStream);
|
41538 |
+
this._contentLength = params.length;
|
41539 |
+
|
41540 |
+
this._fullRequestReader = null;
|
41541 |
+
this._rangeReaders = [];
|
41542 |
+
|
41543 |
+
msgHandler.on('OnDataRange', this._onReceiveData.bind(this));
|
41544 |
+
msgHandler.on('OnDataProgress', this._onProgress.bind(this));
|
41545 |
+
}
|
41546 |
+
PDFWorkerStream.prototype = {
|
41547 |
+
_onReceiveData: function PDFWorkerStream_onReceiveData(args) {
|
41548 |
+
if (args.begin === undefined) {
|
41549 |
+
if (this._fullRequestReader) {
|
41550 |
+
this._fullRequestReader._enqueue(args.chunk);
|
41551 |
+
} else {
|
41552 |
+
this._queuedChunks.push(args.chunk);
|
41553 |
+
}
|
41554 |
+
} else {
|
41555 |
+
var found = this._rangeReaders.some(function (rangeReader) {
|
41556 |
+
if (rangeReader._begin !== args.begin) {
|
41557 |
+
return false;
|
41558 |
+
}
|
41559 |
+
rangeReader._enqueue(args.chunk);
|
41560 |
+
return true;
|
41561 |
+
});
|
41562 |
+
assert(found);
|
41563 |
+
}
|
41564 |
+
},
|
41565 |
+
|
41566 |
+
_onProgress: function PDFWorkerStream_onProgress(evt) {
|
41567 |
+
if (this._rangeReaders.length > 0) {
|
41568 |
+
// Reporting to first range reader.
|
41569 |
+
var firstReader = this._rangeReaders[0];
|
41570 |
+
if (firstReader.onProgress) {
|
41571 |
+
firstReader.onProgress({loaded: evt.loaded});
|
41572 |
+
}
|
41573 |
+
}
|
41574 |
+
},
|
41575 |
+
|
41576 |
+
_removeRangeReader: function PDFWorkerStream_removeRangeReader(reader) {
|
41577 |
+
var i = this._rangeReaders.indexOf(reader);
|
41578 |
+
if (i >= 0) {
|
41579 |
+
this._rangeReaders.splice(i, 1);
|
41580 |
+
}
|
41581 |
+
},
|
41582 |
+
|
41583 |
+
getFullReader: function PDFWorkerStream_getFullReader() {
|
41584 |
+
assert(!this._fullRequestReader);
|
41585 |
+
var queuedChunks = this._queuedChunks;
|
41586 |
+
this._queuedChunks = null;
|
41587 |
+
return new PDFWorkerStreamReader(this, queuedChunks);
|
41588 |
+
},
|
41589 |
+
|
41590 |
+
getRangeReader: function PDFWorkerStream_getRangeReader(begin, end) {
|
41591 |
+
var reader = new PDFWorkerStreamRangeReader(this, begin, end);
|
41592 |
+
this._msgHandler.send('RequestDataRange', { begin: begin, end: end });
|
41593 |
+
this._rangeReaders.push(reader);
|
41594 |
+
return reader;
|
41595 |
+
},
|
41596 |
+
|
41597 |
+
cancelAllRequests: function PDFWorkerStream_cancelAllRequests(reason) {
|
41598 |
+
if (this._fullRequestReader) {
|
41599 |
+
this._fullRequestReader.cancel(reason);
|
41600 |
+
}
|
41601 |
+
var readers = this._rangeReaders.slice(0);
|
41602 |
+
readers.forEach(function (rangeReader) {
|
41603 |
+
rangeReader.cancel(reason);
|
41604 |
+
});
|
41605 |
+
}
|
41606 |
+
};
|
41607 |
+
|
41608 |
+
/** @implements {IPDFStreamReader} */
|
41609 |
+
function PDFWorkerStreamReader(stream, queuedChunks) {
|
41610 |
+
this._stream = stream;
|
41611 |
+
this._done = false;
|
41612 |
+
this._queuedChunks = queuedChunks || [];
|
41613 |
+
this._requests = [];
|
41614 |
+
this._headersReady = Promise.resolve();
|
41615 |
+
stream._fullRequestReader = this;
|
41616 |
+
|
41617 |
+
this.onProgress = null; // not used
|
41618 |
+
}
|
41619 |
+
PDFWorkerStreamReader.prototype = {
|
41620 |
+
_enqueue: function PDFWorkerStreamReader_enqueue(chunk) {
|
41621 |
+
if (this._done) {
|
41622 |
+
return; // ignore new data
|
41623 |
+
}
|
41624 |
+
if (this._requests.length > 0) {
|
41625 |
+
var requestCapability = this._requests.shift();
|
41626 |
+
requestCapability.resolve({value: chunk, done: false});
|
41627 |
+
return;
|
41628 |
+
}
|
41629 |
+
this._queuedChunks.push(chunk);
|
41630 |
+
},
|
41631 |
+
|
41632 |
+
get headersReady() {
|
41633 |
+
return this._headersReady;
|
41634 |
+
},
|
41635 |
+
|
41636 |
+
get isRangeSupported() {
|
41637 |
+
return this._stream._isRangeSupported;
|
41638 |
+
},
|
41639 |
+
|
41640 |
+
get isStreamingSupported() {
|
41641 |
+
return this._stream._isStreamingSupported;
|
41642 |
+
},
|
41643 |
+
|
41644 |
+
get contentLength() {
|
41645 |
+
return this._stream._contentLength;
|
41646 |
+
},
|
41647 |
+
|
41648 |
+
read: function PDFWorkerStreamReader_read() {
|
41649 |
+
if (this._queuedChunks.length > 0) {
|
41650 |
+
var chunk = this._queuedChunks.shift();
|
41651 |
+
return Promise.resolve({value: chunk, done: false});
|
41652 |
+
}
|
41653 |
+
if (this._done) {
|
41654 |
+
return Promise.resolve({value: undefined, done: true});
|
41655 |
+
}
|
41656 |
+
var requestCapability = createPromiseCapability();
|
41657 |
+
this._requests.push(requestCapability);
|
41658 |
+
return requestCapability.promise;
|
41659 |
+
},
|
41660 |
+
|
41661 |
+
cancel: function PDFWorkerStreamReader_cancel(reason) {
|
41662 |
+
this._done = true;
|
41663 |
+
this._requests.forEach(function (requestCapability) {
|
41664 |
+
requestCapability.resolve({value: undefined, done: true});
|
41665 |
+
});
|
41666 |
+
this._requests = [];
|
41667 |
+
}
|
41668 |
+
};
|
41669 |
+
|
41670 |
+
/** @implements {IPDFStreamRangeReader} */
|
41671 |
+
function PDFWorkerStreamRangeReader(stream, begin, end) {
|
41672 |
+
this._stream = stream;
|
41673 |
+
this._begin = begin;
|
41674 |
+
this._end = end;
|
41675 |
+
this._queuedChunk = null;
|
41676 |
+
this._requests = [];
|
41677 |
+
this._done = false;
|
41678 |
+
|
41679 |
+
this.onProgress = null;
|
41680 |
+
}
|
41681 |
+
PDFWorkerStreamRangeReader.prototype = {
|
41682 |
+
_enqueue: function PDFWorkerStreamRangeReader_enqueue(chunk) {
|
41683 |
+
if (this._done) {
|
41684 |
+
return; // ignore new data
|
41685 |
+
}
|
41686 |
+
if (this._requests.length === 0) {
|
41687 |
+
this._queuedChunk = chunk;
|
41688 |
+
} else {
|
41689 |
+
var requestsCapability = this._requests.shift();
|
41690 |
+
requestsCapability.resolve({value: chunk, done: false});
|
41691 |
+
this._requests.forEach(function (requestCapability) {
|
41692 |
+
requestCapability.resolve({value: undefined, done: true});
|
41693 |
+
});
|
41694 |
+
this._requests = [];
|
41695 |
+
}
|
41696 |
+
this._done = true;
|
41697 |
+
this._stream._removeRangeReader(this);
|
41698 |
+
},
|
41699 |
+
|
41700 |
+
get isStreamingSupported() {
|
41701 |
+
return false;
|
41702 |
+
},
|
41703 |
+
|
41704 |
+
read: function PDFWorkerStreamRangeReader_read() {
|
41705 |
+
if (this._queuedChunk) {
|
41706 |
+
return Promise.resolve({value: this._queuedChunk, done: false});
|
41707 |
+
}
|
41708 |
+
if (this._done) {
|
41709 |
+
return Promise.resolve({value: undefined, done: true});
|
41710 |
+
}
|
41711 |
+
var requestCapability = createPromiseCapability();
|
41712 |
+
this._requests.push(requestCapability);
|
41713 |
+
return requestCapability.promise;
|
41714 |
+
},
|
41715 |
+
|
41716 |
+
cancel: function PDFWorkerStreamRangeReader_cancel(reason) {
|
41717 |
+
this._done = true;
|
41718 |
+
this._requests.forEach(function (requestCapability) {
|
41719 |
+
requestCapability.resolve({value: undefined, done: true});
|
41720 |
+
});
|
41721 |
+
this._requests = [];
|
41722 |
+
this._stream._removeRangeReader(this);
|
41723 |
+
}
|
41724 |
+
};
|
41725 |
+
|
41726 |
+
return PDFWorkerStream;
|
41727 |
+
})();
|
41728 |
+
|
41729 |
+
/** @type IPDFStream */
|
41730 |
+
var PDFNetworkStream;
|
41731 |
+
|
41732 |
+
/**
|
41733 |
+
* Sets PDFNetworkStream class to be used as alternative PDF data transport.
|
41734 |
+
* @param {IPDFStream} cls - the PDF data transport.
|
41735 |
+
*/
|
41736 |
+
function setPDFNetworkStreamClass(cls) {
|
41737 |
+
PDFNetworkStream = cls;
|
41738 |
+
}
|
41739 |
+
|
41740 |
var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
41741 |
setup: function wphSetup(handler, port) {
|
41742 |
var testMessageProcessed = false;
|
41843 |
var pdfManager;
|
41844 |
|
41845 |
var source = data.source;
|
|
|
41846 |
if (source.data) {
|
41847 |
try {
|
41848 |
pdfManager = new LocalPdfManager(docId, source.data, source.password);
|
41851 |
pdfManagerCapability.reject(ex);
|
41852 |
}
|
41853 |
return pdfManagerCapability.promise;
|
41854 |
+
}
|
41855 |
+
|
41856 |
+
var pdfStream;
|
41857 |
+
try {
|
41858 |
+
if (source.chunkedViewerLoading) {
|
41859 |
+
pdfStream = new PDFWorkerStream(source, handler);
|
41860 |
+
} else {
|
41861 |
+
assert(PDFNetworkStream, 'pdfjs/core/network module is not loaded');
|
41862 |
+
pdfStream = new PDFNetworkStream(data);
|
41863 |
}
|
41864 |
+
} catch (ex) {
|
41865 |
+
pdfManagerCapability.reject(ex);
|
41866 |
return pdfManagerCapability.promise;
|
41867 |
}
|
41868 |
|
41869 |
+
var fullRequest = pdfStream.getFullReader();
|
41870 |
+
fullRequest.headersReady.then(function () {
|
41871 |
+
if (!fullRequest.isStreamingSupported ||
|
41872 |
+
!fullRequest.isRangeSupported) {
|
41873 |
+
// If stream or range are disabled, it's our only way to report
|
41874 |
+
// loading progress.
|
41875 |
+
fullRequest.onProgress = function (evt) {
|
41876 |
+
handler.send('DocProgress', {
|
41877 |
+
loaded: evt.loaded,
|
41878 |
+
total: evt.total
|
41879 |
+
});
|
41880 |
+
};
|
41881 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41882 |
|
41883 |
+
if (!fullRequest.isRangeSupported) {
|
41884 |
+
return;
|
41885 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41886 |
|
41887 |
+
// We don't need auto-fetch when streaming is enabled.
|
41888 |
+
var disableAutoFetch = source.disableAutoFetch ||
|
41889 |
+
fullRequest.isStreamingSupported;
|
41890 |
+
pdfManager = new NetworkPdfManager(docId, pdfStream, {
|
41891 |
+
msgHandler: handler,
|
41892 |
+
url: source.url,
|
41893 |
+
password: source.password,
|
41894 |
+
length: fullRequest.contentLength,
|
41895 |
+
disableAutoFetch: disableAutoFetch,
|
41896 |
+
rangeChunkSize: source.rangeChunkSize
|
41897 |
+
});
|
41898 |
+
pdfManagerCapability.resolve(pdfManager);
|
41899 |
+
cancelXHRs = null;
|
41900 |
+
}).catch(function (reason) {
|
41901 |
+
pdfManagerCapability.reject(reason);
|
41902 |
+
cancelXHRs = null;
|
41903 |
+
});
|
41904 |
|
41905 |
+
var cachedChunks = [], loaded = 0;
|
41906 |
+
var flushChunks = function () {
|
41907 |
+
var pdfFile = arraysToBytes(cachedChunks);
|
41908 |
+
if (source.length && pdfFile.length !== source.length) {
|
41909 |
+
warn('reported HTTP length is different from actual');
|
41910 |
+
}
|
41911 |
+
// the data is array, instantiating directly from it
|
41912 |
+
try {
|
41913 |
+
pdfManager = new LocalPdfManager(docId, pdfFile, source.password);
|
41914 |
+
pdfManagerCapability.resolve(pdfManager);
|
41915 |
+
} catch (ex) {
|
41916 |
+
pdfManagerCapability.reject(ex);
|
41917 |
+
}
|
41918 |
+
cachedChunks = [];
|
41919 |
+
};
|
41920 |
+
var readPromise = new Promise(function (resolve, reject) {
|
41921 |
+
var readChunk = function (chunk) {
|
41922 |
try {
|
41923 |
+
ensureNotTerminated();
|
41924 |
+
if (chunk.done) {
|
41925 |
+
if (!pdfManager) {
|
41926 |
+
flushChunks();
|
41927 |
+
}
|
41928 |
+
cancelXHRs = null;
|
41929 |
+
return;
|
41930 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41931 |
|
41932 |
+
var data = chunk.value;
|
41933 |
+
loaded += arrayByteLength(data);
|
41934 |
+
if (!fullRequest.isStreamingSupported) {
|
41935 |
+
handler.send('DocProgress', {
|
41936 |
+
loaded: loaded,
|
41937 |
+
total: Math.max(loaded, fullRequest.contentLength || 0)
|
41938 |
+
});
|
|
|
|
|
|
|
41939 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41940 |
|
41941 |
+
if (pdfManager) {
|
41942 |
+
pdfManager.sendProgressiveData(data);
|
41943 |
+
} else {
|
41944 |
+
cachedChunks.push(data);
|
41945 |
+
}
|
|
|
|
|
|
|
|
|
41946 |
|
41947 |
+
fullRequest.read().then(readChunk, reject);
|
41948 |
+
} catch (e) {
|
41949 |
+
reject(e);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41950 |
}
|
41951 |
+
};
|
41952 |
+
fullRequest.read().then(readChunk, reject);
|
41953 |
+
});
|
41954 |
+
readPromise.catch(function (e) {
|
41955 |
+
pdfManagerCapability.reject(e);
|
41956 |
+
cancelXHRs = null;
|
|
|
|
|
|
|
41957 |
});
|
41958 |
|
41959 |
cancelXHRs = function () {
|
41960 |
+
pdfStream.cancelAllRequests('abort');
|
41961 |
};
|
41962 |
|
41963 |
return pdfManagerCapability.promise;
|
42298 |
initializeWorker();
|
42299 |
}
|
42300 |
|
42301 |
+
exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass;
|
42302 |
exports.WorkerTask = WorkerTask;
|
42303 |
exports.WorkerMessageHandler = WorkerMessageHandler;
|
42304 |
}));
|
42305 |
|
42306 |
|
42307 |
+
|
42308 |
+
|
42309 |
+
var NetworkManager = (function NetworkManagerClosure() {
|
42310 |
+
|
42311 |
+
var OK_RESPONSE = 200;
|
42312 |
+
var PARTIAL_CONTENT_RESPONSE = 206;
|
42313 |
+
|
42314 |
+
function NetworkManager(url, args) {
|
42315 |
+
this.url = url;
|
42316 |
+
args = args || {};
|
42317 |
+
this.isHttp = /^https?:/i.test(url);
|
42318 |
+
this.httpHeaders = (this.isHttp && args.httpHeaders) || {};
|
42319 |
+
this.withCredentials = args.withCredentials || false;
|
42320 |
+
this.getXhr = args.getXhr ||
|
42321 |
+
function NetworkManager_getXhr() {
|
42322 |
+
return new XMLHttpRequest();
|
42323 |
+
};
|
42324 |
+
|
42325 |
+
this.currXhrId = 0;
|
42326 |
+
this.pendingRequests = Object.create(null);
|
42327 |
+
this.loadedRequests = Object.create(null);
|
42328 |
+
}
|
42329 |
+
|
42330 |
+
function getArrayBuffer(xhr) {
|
42331 |
+
var data = xhr.response;
|
42332 |
+
if (typeof data !== 'string') {
|
42333 |
+
return data;
|
42334 |
+
}
|
42335 |
+
var length = data.length;
|
42336 |
+
var array = new Uint8Array(length);
|
42337 |
+
for (var i = 0; i < length; i++) {
|
42338 |
+
array[i] = data.charCodeAt(i) & 0xFF;
|
42339 |
+
}
|
42340 |
+
return array.buffer;
|
42341 |
+
}
|
42342 |
+
|
42343 |
+
var supportsMozChunked = (function supportsMozChunkedClosure() {
|
42344 |
+
try {
|
42345 |
+
var x = new XMLHttpRequest();
|
42346 |
+
// Firefox 37- required .open() to be called before setting responseType.
|
42347 |
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=707484
|
42348 |
+
// Even though the URL is not visited, .open() could fail if the URL is
|
42349 |
+
// blocked, e.g. via the connect-src CSP directive or the NoScript addon.
|
42350 |
+
// When this error occurs, this feature detection method will mistakenly
|
42351 |
+
// report that moz-chunked-arraybuffer is not supported in Firefox 37-.
|
42352 |
+
x.open('GET', 'https://example.com');
|
42353 |
+
x.responseType = 'moz-chunked-arraybuffer';
|
42354 |
+
return x.responseType === 'moz-chunked-arraybuffer';
|
42355 |
+
} catch (e) {
|
42356 |
+
return false;
|
42357 |
+
}
|
42358 |
+
})();
|
42359 |
+
|
42360 |
+
NetworkManager.prototype = {
|
42361 |
+
requestRange: function NetworkManager_requestRange(begin, end, listeners) {
|
42362 |
+
var args = {
|
42363 |
+
begin: begin,
|
42364 |
+
end: end
|
42365 |
+
};
|
42366 |
+
for (var prop in listeners) {
|
42367 |
+
args[prop] = listeners[prop];
|
42368 |
+
}
|
42369 |
+
return this.request(args);
|
42370 |
+
},
|
42371 |
+
|
42372 |
+
requestFull: function NetworkManager_requestFull(listeners) {
|
42373 |
+
return this.request(listeners);
|
42374 |
+
},
|
42375 |
+
|
42376 |
+
request: function NetworkManager_request(args) {
|
42377 |
+
var xhr = this.getXhr();
|
42378 |
+
var xhrId = this.currXhrId++;
|
42379 |
+
var pendingRequest = this.pendingRequests[xhrId] = {
|
42380 |
+
xhr: xhr
|
42381 |
+
};
|
42382 |
+
|
42383 |
+
xhr.open('GET', this.url);
|
42384 |
+
xhr.withCredentials = this.withCredentials;
|
42385 |
+
for (var property in this.httpHeaders) {
|
42386 |
+
var value = this.httpHeaders[property];
|
42387 |
+
if (typeof value === 'undefined') {
|
42388 |
+
continue;
|
42389 |
+
}
|
42390 |
+
xhr.setRequestHeader(property, value);
|
42391 |
+
}
|
42392 |
+
if (this.isHttp && 'begin' in args && 'end' in args) {
|
42393 |
+
var rangeStr = args.begin + '-' + (args.end - 1);
|
42394 |
+
xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
|
42395 |
+
pendingRequest.expectedStatus = 206;
|
42396 |
+
} else {
|
42397 |
+
pendingRequest.expectedStatus = 200;
|
42398 |
+
}
|
42399 |
+
|
42400 |
+
var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData;
|
42401 |
+
if (useMozChunkedLoading) {
|
42402 |
+
xhr.responseType = 'moz-chunked-arraybuffer';
|
42403 |
+
pendingRequest.onProgressiveData = args.onProgressiveData;
|
42404 |
+
pendingRequest.mozChunked = true;
|
42405 |
+
} else {
|
42406 |
+
xhr.responseType = 'arraybuffer';
|
42407 |
+
}
|
42408 |
+
|
42409 |
+
if (args.onError) {
|
42410 |
+
xhr.onerror = function(evt) {
|
42411 |
+
args.onError(xhr.status);
|
42412 |
+
};
|
42413 |
+
}
|
42414 |
+
xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
|
42415 |
+
xhr.onprogress = this.onProgress.bind(this, xhrId);
|
42416 |
+
|
42417 |
+
pendingRequest.onHeadersReceived = args.onHeadersReceived;
|
42418 |
+
pendingRequest.onDone = args.onDone;
|
42419 |
+
pendingRequest.onError = args.onError;
|
42420 |
+
pendingRequest.onProgress = args.onProgress;
|
42421 |
+
|
42422 |
+
xhr.send(null);
|
42423 |
+
|
42424 |
+
return xhrId;
|
42425 |
+
},
|
42426 |
+
|
42427 |
+
onProgress: function NetworkManager_onProgress(xhrId, evt) {
|
42428 |
+
var pendingRequest = this.pendingRequests[xhrId];
|
42429 |
+
if (!pendingRequest) {
|
42430 |
+
// Maybe abortRequest was called...
|
42431 |
+
return;
|
42432 |
+
}
|
42433 |
+
|
42434 |
+
if (pendingRequest.mozChunked) {
|
42435 |
+
var chunk = getArrayBuffer(pendingRequest.xhr);
|
42436 |
+
pendingRequest.onProgressiveData(chunk);
|
42437 |
+
}
|
42438 |
+
|
42439 |
+
var onProgress = pendingRequest.onProgress;
|
42440 |
+
if (onProgress) {
|
42441 |
+
onProgress(evt);
|
42442 |
+
}
|
42443 |
+
},
|
42444 |
+
|
42445 |
+
onStateChange: function NetworkManager_onStateChange(xhrId, evt) {
|
42446 |
+
var pendingRequest = this.pendingRequests[xhrId];
|
42447 |
+
if (!pendingRequest) {
|
42448 |
+
// Maybe abortRequest was called...
|
42449 |
+
return;
|
42450 |
+
}
|
42451 |
+
|
42452 |
+
var xhr = pendingRequest.xhr;
|
42453 |
+
if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
|
42454 |
+
pendingRequest.onHeadersReceived();
|
42455 |
+
delete pendingRequest.onHeadersReceived;
|
42456 |
+
}
|
42457 |
+
|
42458 |
+
if (xhr.readyState !== 4) {
|
42459 |
+
return;
|
42460 |
+
}
|
42461 |
+
|
42462 |
+
if (!(xhrId in this.pendingRequests)) {
|
42463 |
+
// The XHR request might have been aborted in onHeadersReceived()
|
42464 |
+
// callback, in which case we should abort request
|
42465 |
+
return;
|
42466 |
+
}
|
42467 |
+
|
42468 |
+
delete this.pendingRequests[xhrId];
|
42469 |
+
|
42470 |
+
// success status == 0 can be on ftp, file and other protocols
|
42471 |
+
if (xhr.status === 0 && this.isHttp) {
|
42472 |
+
if (pendingRequest.onError) {
|
42473 |
+
pendingRequest.onError(xhr.status);
|
42474 |
+
}
|
42475 |
+
return;
|
42476 |
+
}
|
42477 |
+
var xhrStatus = xhr.status || OK_RESPONSE;
|
42478 |
+
|
42479 |
+
// From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.2:
|
42480 |
+
// "A server MAY ignore the Range header". This means it's possible to
|
42481 |
+
// get a 200 rather than a 206 response from a range request.
|
42482 |
+
var ok_response_on_range_request =
|
42483 |
+
xhrStatus === OK_RESPONSE &&
|
42484 |
+
pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
|
42485 |
+
|
42486 |
+
if (!ok_response_on_range_request &&
|
42487 |
+
xhrStatus !== pendingRequest.expectedStatus) {
|
42488 |
+
if (pendingRequest.onError) {
|
42489 |
+
pendingRequest.onError(xhr.status);
|
42490 |
+
}
|
42491 |
+
return;
|
42492 |
+
}
|
42493 |
+
|
42494 |
+
this.loadedRequests[xhrId] = true;
|
42495 |
+
|
42496 |
+
var chunk = getArrayBuffer(xhr);
|
42497 |
+
if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
|
42498 |
+
var rangeHeader = xhr.getResponseHeader('Content-Range');
|
42499 |
+
var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
|
42500 |
+
var begin = parseInt(matches[1], 10);
|
42501 |
+
pendingRequest.onDone({
|
42502 |
+
begin: begin,
|
42503 |
+
chunk: chunk
|
42504 |
+
});
|
42505 |
+
} else if (pendingRequest.onProgressiveData) {
|
42506 |
+
pendingRequest.onDone(null);
|
42507 |
+
} else if (chunk) {
|
42508 |
+
pendingRequest.onDone({
|
42509 |
+
begin: 0,
|
42510 |
+
chunk: chunk
|
42511 |
+
});
|
42512 |
+
} else if (pendingRequest.onError) {
|
42513 |
+
pendingRequest.onError(xhr.status);
|
42514 |
+
}
|
42515 |
+
},
|
42516 |
+
|
42517 |
+
hasPendingRequests: function NetworkManager_hasPendingRequests() {
|
42518 |
+
for (var xhrId in this.pendingRequests) {
|
42519 |
+
return true;
|
42520 |
+
}
|
42521 |
+
return false;
|
42522 |
+
},
|
42523 |
+
|
42524 |
+
getRequestXhr: function NetworkManager_getXhr(xhrId) {
|
42525 |
+
return this.pendingRequests[xhrId].xhr;
|
42526 |
+
},
|
42527 |
+
|
42528 |
+
isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) {
|
42529 |
+
return !!(this.pendingRequests[xhrId].onProgressiveData);
|
42530 |
+
},
|
42531 |
+
|
42532 |
+
isPendingRequest: function NetworkManager_isPendingRequest(xhrId) {
|
42533 |
+
return xhrId in this.pendingRequests;
|
42534 |
+
},
|
42535 |
+
|
42536 |
+
isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) {
|
42537 |
+
return xhrId in this.loadedRequests;
|
42538 |
+
},
|
42539 |
+
|
42540 |
+
abortAllRequests: function NetworkManager_abortAllRequests() {
|
42541 |
+
for (var xhrId in this.pendingRequests) {
|
42542 |
+
this.abortRequest(xhrId | 0);
|
42543 |
+
}
|
42544 |
+
},
|
42545 |
+
|
42546 |
+
abortRequest: function NetworkManager_abortRequest(xhrId) {
|
42547 |
+
var xhr = this.pendingRequests[xhrId].xhr;
|
42548 |
+
delete this.pendingRequests[xhrId];
|
42549 |
+
xhr.abort();
|
42550 |
+
}
|
42551 |
+
};
|
42552 |
+
|
42553 |
+
return NetworkManager;
|
42554 |
+
})();
|
42555 |
+
|
42556 |
+
(function (root, factory) {
|
42557 |
+
{
|
42558 |
+
factory((root.pdfjsCoreNetwork = {}), root.pdfjsSharedUtil,
|
42559 |
+
root.pdfjsCoreWorker);
|
42560 |
+
}
|
42561 |
+
}(this, function (exports, sharedUtil, coreWorker) {
|
42562 |
+
|
42563 |
+
var assert = sharedUtil.assert;
|
42564 |
+
var createPromiseCapability = sharedUtil.createPromiseCapability;
|
42565 |
+
var isInt = sharedUtil.isInt;
|
42566 |
+
var MissingPDFException = sharedUtil.MissingPDFException;
|
42567 |
+
var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
|
42568 |
+
|
42569 |
+
/** @implements {IPDFStream} */
|
42570 |
+
function PDFNetworkStream(options) {
|
42571 |
+
this._options = options;
|
42572 |
+
var source = options.source;
|
42573 |
+
this._manager = new NetworkManager(source.url, {
|
42574 |
+
httpHeaders: source.httpHeaders,
|
42575 |
+
withCredentials: source.withCredentials
|
42576 |
+
});
|
42577 |
+
this._rangeChunkSize = source.rangeChunkSize;
|
42578 |
+
this._fullRequestReader = null;
|
42579 |
+
this._rangeRequestReaders = [];
|
42580 |
+
}
|
42581 |
+
|
42582 |
+
PDFNetworkStream.prototype = {
|
42583 |
+
_onRangeRequestReaderClosed:
|
42584 |
+
function PDFNetworkStream_onRangeRequestReaderClosed(reader) {
|
42585 |
+
var i = this._rangeRequestReaders.indexOf(reader);
|
42586 |
+
if (i >= 0) {
|
42587 |
+
this._rangeRequestReaders.splice(i, 1);
|
42588 |
+
}
|
42589 |
+
},
|
42590 |
+
|
42591 |
+
getFullReader: function PDFNetworkStream_getFullReader() {
|
42592 |
+
assert(!this._fullRequestReader);
|
42593 |
+
this._fullRequestReader =
|
42594 |
+
new PDFNetworkStreamFullRequestReader(this._manager, this._options);
|
42595 |
+
return this._fullRequestReader;
|
42596 |
+
},
|
42597 |
+
|
42598 |
+
getRangeReader: function PDFNetworkStream_getRangeReader(begin, end) {
|
42599 |
+
var reader = new PDFNetworkStreamRangeRequestReader(this._manager,
|
42600 |
+
begin, end);
|
42601 |
+
reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
|
42602 |
+
this._rangeRequestReaders.push(reader);
|
42603 |
+
return reader;
|
42604 |
+
},
|
42605 |
+
|
42606 |
+
cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) {
|
42607 |
+
if (this._fullRequestReader) {
|
42608 |
+
this._fullRequestReader.cancel(reason);
|
42609 |
+
}
|
42610 |
+
var readers = this._rangeRequestReaders.slice(0);
|
42611 |
+
readers.forEach(function (reader) {
|
42612 |
+
reader.cancel(reason);
|
42613 |
+
});
|
42614 |
+
}
|
42615 |
+
};
|
42616 |
+
|
42617 |
+
/** @implements {IPDFStreamReader} */
|
42618 |
+
function PDFNetworkStreamFullRequestReader(manager, options) {
|
42619 |
+
this._manager = manager;
|
42620 |
+
|
42621 |
+
var source = options.source;
|
42622 |
+
var args = {
|
42623 |
+
onHeadersReceived: this._onHeadersReceived.bind(this),
|
42624 |
+
onProgressiveData: source.disableStream ? null :
|
42625 |
+
this._onProgressiveData.bind(this),
|
42626 |
+
onDone: this._onDone.bind(this),
|
42627 |
+
onError: this._onError.bind(this),
|
42628 |
+
onProgress: this._onProgress.bind(this)
|
42629 |
+
};
|
42630 |
+
this._url = source.url;
|
42631 |
+
this._fullRequestId = manager.requestFull(args);
|
42632 |
+
this._headersReceivedCapability = createPromiseCapability();
|
42633 |
+
this._disableRange = options.disableRange || false;
|
42634 |
+
this._contentLength = source.length; // optional
|
42635 |
+
this._rangeChunkSize = source.rangeChunkSize;
|
42636 |
+
if (!this._rangeChunkSize && !this._disableRange) {
|
42637 |
+
this._disableRange = true;
|
42638 |
+
}
|
42639 |
+
|
42640 |
+
this._isStreamingSupported = false;
|
42641 |
+
this._isRangeSupported = false;
|
42642 |
+
|
42643 |
+
this._cachedChunks = [];
|
42644 |
+
this._requests = [];
|
42645 |
+
this._done = false;
|
42646 |
+
this._storedError = undefined;
|
42647 |
+
|
42648 |
+
this.onProgress = null;
|
42649 |
+
}
|
42650 |
+
|
42651 |
+
PDFNetworkStreamFullRequestReader.prototype = {
|
42652 |
+
_validateRangeRequestCapabilities: function
|
42653 |
+
PDFNetworkStreamFullRequestReader_validateRangeRequestCapabilities() {
|
42654 |
+
|
42655 |
+
if (this._disableRange) {
|
42656 |
+
return false;
|
42657 |
+
}
|
42658 |
+
|
42659 |
+
var networkManager = this._manager;
|
42660 |
+
var fullRequestXhrId = this._fullRequestId;
|
42661 |
+
var fullRequestXhr = networkManager.getRequestXhr(fullRequestXhrId);
|
42662 |
+
if (fullRequestXhr.getResponseHeader('Accept-Ranges') !== 'bytes') {
|
42663 |
+
return false;
|
42664 |
+
}
|
42665 |
+
|
42666 |
+
var contentEncoding =
|
42667 |
+
fullRequestXhr.getResponseHeader('Content-Encoding') || 'identity';
|
42668 |
+
if (contentEncoding !== 'identity') {
|
42669 |
+
return false;
|
42670 |
+
}
|
42671 |
+
|
42672 |
+
var length = fullRequestXhr.getResponseHeader('Content-Length');
|
42673 |
+
length = parseInt(length, 10);
|
42674 |
+
if (!isInt(length)) {
|
42675 |
+
return false;
|
42676 |
+
}
|
42677 |
+
|
42678 |
+
this._contentLength = length; // setting right content length
|
42679 |
+
|
42680 |
+
if (length <= 2 * this._rangeChunkSize) {
|
42681 |
+
// The file size is smaller than the size of two chunks, so it does
|
42682 |
+
// not make any sense to abort the request and retry with a range
|
42683 |
+
// request.
|
42684 |
+
return false;
|
42685 |
+
}
|
42686 |
+
|
42687 |
+
return true;
|
42688 |
+
},
|
42689 |
+
|
42690 |
+
_onHeadersReceived:
|
42691 |
+
function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
|
42692 |
+
|
42693 |
+
if (this._validateRangeRequestCapabilities()) {
|
42694 |
+
this._isRangeSupported = true;
|
42695 |
+
}
|
42696 |
+
|
42697 |
+
var networkManager = this._manager;
|
42698 |
+
var fullRequestXhrId = this._fullRequestId;
|
42699 |
+
if (networkManager.isStreamingRequest(fullRequestXhrId)) {
|
42700 |
+
// We can continue fetching when progressive loading is enabled,
|
42701 |
+
// and we don't need the autoFetch feature.
|
42702 |
+
this._isStreamingSupported = true;
|
42703 |
+
} else if (this._isRangeSupported) {
|
42704 |
+
// NOTE: by cancelling the full request, and then issuing range
|
42705 |
+
// requests, there will be an issue for sites where you can only
|
42706 |
+
// request the pdf once. However, if this is the case, then the
|
42707 |
+
// server should not be returning that it can support range
|
42708 |
+
// requests.
|
42709 |
+
networkManager.abortRequest(fullRequestXhrId);
|
42710 |
+
}
|
42711 |
+
|
42712 |
+
this._headersReceivedCapability.resolve();
|
42713 |
+
},
|
42714 |
+
|
42715 |
+
_onProgressiveData:
|
42716 |
+
function PDFNetworkStreamFullRequestReader_onProgressiveData(chunk) {
|
42717 |
+
if (this._requests.length > 0) {
|
42718 |
+
var requestCapability = this._requests.shift();
|
42719 |
+
requestCapability.resolve({value: chunk, done: false});
|
42720 |
+
} else {
|
42721 |
+
this._cachedChunks.push(chunk);
|
42722 |
+
}
|
42723 |
+
},
|
42724 |
+
|
42725 |
+
_onDone: function PDFNetworkStreamFullRequestReader_onDone(args) {
|
42726 |
+
if (args) {
|
42727 |
+
this._onProgressiveData(args.chunk);
|
42728 |
+
}
|
42729 |
+
this._done = true;
|
42730 |
+
if (this._cachedChunks.length > 0) {
|
42731 |
+
return;
|
42732 |
+
}
|
42733 |
+
this._requests.forEach(function (requestCapability) {
|
42734 |
+
requestCapability.resolve({value: undefined, done: true});
|
42735 |
+
});
|
42736 |
+
this._requests = [];
|
42737 |
+
},
|
42738 |
+
|
42739 |
+
_onError: function PDFNetworkStreamFullRequestReader_onError(status) {
|
42740 |
+
var url = this._url;
|
42741 |
+
var exception;
|
42742 |
+
if (status === 404 || status === 0 && /^file:/.test(url)) {
|
42743 |
+
exception = new MissingPDFException('Missing PDF "' + url + '".');
|
42744 |
+
} else {
|
42745 |
+
exception = new UnexpectedResponseException(
|
42746 |
+
'Unexpected server response (' + status +
|
42747 |
+
') while retrieving PDF "' + url + '".', status);
|
42748 |
+
}
|
42749 |
+
this._storedError = exception;
|
42750 |
+
this._headersReceivedCapability.reject(exception);
|
42751 |
+
this._requests.forEach(function (requestCapability) {
|
42752 |
+
requestCapability.reject(exception);
|
42753 |
+
});
|
42754 |
+
this._requests = [];
|
42755 |
+
this._cachedChunks = [];
|
42756 |
+
},
|
42757 |
+
|
42758 |
+
_onProgress: function PDFNetworkStreamFullRequestReader_onProgress(data) {
|
42759 |
+
if (this.onProgress) {
|
42760 |
+
this.onProgress({
|
42761 |
+
loaded: data.loaded,
|
42762 |
+
total: data.lengthComputable ? data.total : this._contentLength
|
42763 |
+
});
|
42764 |
+
}
|
42765 |
+
},
|
42766 |
+
|
42767 |
+
get isRangeSupported() {
|
42768 |
+
return this._isRangeSupported;
|
42769 |
+
},
|
42770 |
+
|
42771 |
+
get isStreamingSupported() {
|
42772 |
+
return this._isStreamingSupported;
|
42773 |
+
},
|
42774 |
+
|
42775 |
+
get contentLength() {
|
42776 |
+
return this._contentLength;
|
42777 |
+
},
|
42778 |
+
|
42779 |
+
get headersReady() {
|
42780 |
+
return this._headersReceivedCapability.promise;
|
42781 |
+
},
|
42782 |
+
|
42783 |
+
read: function PDFNetworkStreamFullRequestReader_read() {
|
42784 |
+
if (this._storedError) {
|
42785 |
+
return Promise.reject(this._storedError);
|
42786 |
+
}
|
42787 |
+
if (this._cachedChunks.length > 0) {
|
42788 |
+
var chunk = this._cachedChunks.shift();
|
42789 |
+
return Promise.resolve(chunk);
|
42790 |
+
}
|
42791 |
+
if (this._done) {
|
42792 |
+
return Promise.resolve({value: undefined, done: true});
|
42793 |
+
}
|
42794 |
+
var requestCapability = createPromiseCapability();
|
42795 |
+
this._requests.push(requestCapability);
|
42796 |
+
return requestCapability.promise;
|
42797 |
+
},
|
42798 |
+
|
42799 |
+
cancel: function PDFNetworkStreamFullRequestReader_cancel(reason) {
|
42800 |
+
this._done = true;
|
42801 |
+
this._headersReceivedCapability.reject(reason);
|
42802 |
+
this._requests.forEach(function (requestCapability) {
|
42803 |
+
requestCapability.resolve({value: undefined, done: true});
|
42804 |
+
});
|
42805 |
+
this._requests = [];
|
42806 |
+
if (this._manager.isPendingRequest(this._fullRequestId)) {
|
42807 |
+
this._manager.abortRequest(this._fullRequestId);
|
42808 |
+
}
|
42809 |
+
this._fullRequestReader = null;
|
42810 |
+
}
|
42811 |
+
};
|
42812 |
+
|
42813 |
+
/** @implements {IPDFStreamRangeReader} */
|
42814 |
+
function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
|
42815 |
+
this._manager = manager;
|
42816 |
+
var args = {
|
42817 |
+
onDone: this._onDone.bind(this),
|
42818 |
+
onProgress: this._onProgress.bind(this)
|
42819 |
+
};
|
42820 |
+
this._requestId = manager.requestRange(begin, end, args);
|
42821 |
+
this._requests = [];
|
42822 |
+
this._queuedChunk = null;
|
42823 |
+
this._done = false;
|
42824 |
+
|
42825 |
+
this.onProgress = null;
|
42826 |
+
this.onClosed = null;
|
42827 |
+
}
|
42828 |
+
|
42829 |
+
PDFNetworkStreamRangeRequestReader.prototype = {
|
42830 |
+
_close: function PDFNetworkStreamRangeRequestReader_close() {
|
42831 |
+
if (this.onClosed) {
|
42832 |
+
this.onClosed(this);
|
42833 |
+
}
|
42834 |
+
},
|
42835 |
+
|
42836 |
+
_onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) {
|
42837 |
+
var chunk = data.chunk;
|
42838 |
+
if (this._requests.length > 0) {
|
42839 |
+
var requestCapability = this._requests.shift();
|
42840 |
+
requestCapability.resolve({value: chunk, done: false});
|
42841 |
+
} else {
|
42842 |
+
this._queuedChunk = chunk;
|
42843 |
+
}
|
42844 |
+
this._done = true;
|
42845 |
+
this._requests.forEach(function (requestCapability) {
|
42846 |
+
requestCapability.resolve({value: undefined, done: true});
|
42847 |
+
});
|
42848 |
+
this._requests = [];
|
42849 |
+
this._close();
|
42850 |
+
},
|
42851 |
+
|
42852 |
+
_onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) {
|
42853 |
+
if (!this.isStreamingSupported && this.onProgress) {
|
42854 |
+
this.onProgress({
|
42855 |
+
loaded: evt.loaded
|
42856 |
+
});
|
42857 |
+
}
|
42858 |
+
},
|
42859 |
+
|
42860 |
+
get isStreamingSupported() {
|
42861 |
+
return false; // TODO allow progressive range bytes loading
|
42862 |
+
},
|
42863 |
+
|
42864 |
+
read: function PDFNetworkStreamRangeRequestReader_read() {
|
42865 |
+
if (this._queuedChunk !== null) {
|
42866 |
+
var chunk = this._queuedChunk;
|
42867 |
+
this._queuedChunk = null;
|
42868 |
+
return Promise.resolve({value: chunk, done: false});
|
42869 |
+
}
|
42870 |
+
if (this._done) {
|
42871 |
+
return Promise.resolve({value: undefined, done: true});
|
42872 |
+
}
|
42873 |
+
var requestCapability = createPromiseCapability();
|
42874 |
+
this._requests.push(requestCapability);
|
42875 |
+
return requestCapability.promise;
|
42876 |
+
},
|
42877 |
+
|
42878 |
+
cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) {
|
42879 |
+
this._done = true;
|
42880 |
+
this._requests.forEach(function (requestCapability) {
|
42881 |
+
requestCapability.resolve({value: undefined, done: true});
|
42882 |
+
});
|
42883 |
+
this._requests = [];
|
42884 |
+
if (this._manager.isPendingRequest(this._requestId)) {
|
42885 |
+
this._manager.abortRequest(this._requestId);
|
42886 |
+
}
|
42887 |
+
this._close();
|
42888 |
+
}
|
42889 |
+
};
|
42890 |
+
|
42891 |
+
coreWorker.setPDFNetworkStreamClass(PDFNetworkStream);
|
42892 |
+
|
42893 |
+
exports.PDFNetworkStream = PDFNetworkStream;
|
42894 |
+
exports.NetworkManager = NetworkManager;
|
42895 |
+
}));
|
42896 |
+
|
42897 |
+
|
42898 |
}).call(pdfjsLibs);
|
42899 |
|
42900 |
exports.PDFJS = pdfjsLibs.pdfjsSharedGlobal.PDFJS;
|
lang/pdf-embedder-fr_FR.mo
ADDED
Binary file
|
lang/pdf-embedder-fr_FR.po
ADDED
@@ -0,0 +1,630 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2016
|
2 |
+
# This file is distributed under the same license as the package.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: \n"
|
6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/PDFEmbedder\n"
|
7 |
+
"POT-Creation-Date: 2016-03-23 16:27+0100\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2016-03-23 17:46+0100\n"
|
12 |
+
"Language-Team: \n"
|
13 |
+
"X-Generator: Poedit 1.8.7\n"
|
14 |
+
"Last-Translator: \n"
|
15 |
+
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
16 |
+
"Language: fr_FR\n"
|
17 |
+
|
18 |
+
#: basic_pdf_embedder.php:76
|
19 |
+
msgid "Options only available in Premium versions"
|
20 |
+
msgstr "En option seulement dans les versions premium"
|
21 |
+
|
22 |
+
#: basic_pdf_embedder.php:78 core/commercial_pdf_embedder.php:64
|
23 |
+
msgid "Download Button"
|
24 |
+
msgstr "Bouton téléchargement"
|
25 |
+
|
26 |
+
#: basic_pdf_embedder.php:80
|
27 |
+
msgid "Provide PDF download button on toolbar"
|
28 |
+
msgstr "Affiche un bouton téléchargement dans la barre d'outils"
|
29 |
+
|
30 |
+
#: basic_pdf_embedder.php:85 core/commercial_pdf_embedder.php:73
|
31 |
+
msgid "Track Views/Downloads"
|
32 |
+
msgstr "Suivre Vues / Téléchargements"
|
33 |
+
|
34 |
+
#: basic_pdf_embedder.php:87
|
35 |
+
msgid "Count number of views and downloads"
|
36 |
+
msgstr "Compter le nombre de vues et téléchargements"
|
37 |
+
|
38 |
+
#: basic_pdf_embedder.php:92 core/commercial_pdf_embedder.php:82
|
39 |
+
msgid "External Links"
|
40 |
+
msgstr "Liens externes"
|
41 |
+
|
42 |
+
#: basic_pdf_embedder.php:94 core/commercial_pdf_embedder.php:85
|
43 |
+
msgid "Open links in a new browser tab/window"
|
44 |
+
msgstr "Ouvrir les liens dans un nouvel onglet de navigateur / fenêtre"
|
45 |
+
|
46 |
+
#: basic_pdf_embedder.php:99 core/commercial_pdf_embedder.php:91
|
47 |
+
msgid "Scroll to Top"
|
48 |
+
msgstr "Défiler vers le Haut"
|
49 |
+
|
50 |
+
#: basic_pdf_embedder.php:101 core/commercial_pdf_embedder.php:94
|
51 |
+
msgid "Scroll to top of page when user clicks next/prev"
|
52 |
+
msgstr ""
|
53 |
+
"Défiler au haut de la page lorsque l'utilisateur clique suivante / précédente"
|
54 |
+
|
55 |
+
#: basic_pdf_embedder.php:105
|
56 |
+
msgid ""
|
57 |
+
"Find out more about <a href=\"%s\" target=\"_blank\">Premium Versions of the "
|
58 |
+
"plugin on our website</a>."
|
59 |
+
msgstr ""
|
60 |
+
"Pour en savoir plus sur <a href=\"%s\" target=\"_blank\">les Versions "
|
61 |
+
"premium du plugin sur notre site</a>."
|
62 |
+
|
63 |
+
#: basic_pdf_embedder.php:115
|
64 |
+
msgid "Mobile-friendly embedding using PDF Embedder Premium"
|
65 |
+
msgstr "Intégration pour mobiles en utilisant PDF Embedder premium"
|
66 |
+
|
67 |
+
#: basic_pdf_embedder.php:116
|
68 |
+
msgid ""
|
69 |
+
"This free version of the plugin should work on most mobile browsers, but it "
|
70 |
+
"will be cumbersome for users with small screens - it is difficult to "
|
71 |
+
"position\n"
|
72 |
+
" the document entirely within the screen, and your users' fingers "
|
73 |
+
"may catch the entire browser page when\n"
|
74 |
+
" they're trying only to move about the document..."
|
75 |
+
msgstr ""
|
76 |
+
"Cette version gratuite du plugin devrait fonctionner sur la plupart des "
|
77 |
+
"navigateurs mobiles, mais il sera lourd pour les utilisateurs avec de petits "
|
78 |
+
"écrans - il est difficile de position\n"
|
79 |
+
" le document entièrement à l'intérieur de l'écran, et les doigts "
|
80 |
+
"de vos utilisateurs peuvent attraper la page entière du navigateur lorsque\n"
|
81 |
+
" ils essaient seulement de se déplacer sur le document..."
|
82 |
+
|
83 |
+
#: basic_pdf_embedder.php:120
|
84 |
+
msgid ""
|
85 |
+
"Our <b>PDF Embedder Premium</b> plugin solves this problem with an "
|
86 |
+
"intelligent 'full screen' mode.\n"
|
87 |
+
" When the document is smaller than a certain width, the document "
|
88 |
+
"displays only as a 'thumbnail' with a large\n"
|
89 |
+
" 'View in Full Screen' button for the\n"
|
90 |
+
" user to click when they want to study your document.\n"
|
91 |
+
" This opens up the document so it has the full focus of the "
|
92 |
+
"mobile browser, and the user can move about the\n"
|
93 |
+
" document without hitting other parts of\n"
|
94 |
+
" the web page by mistake. Click Exit to return to the regular web "
|
95 |
+
"page."
|
96 |
+
msgstr ""
|
97 |
+
"Notre plugin <b>PDF Embedder Premium</b> résout ce problème avec un mode "
|
98 |
+
"intelligent \"plein écran\".\n"
|
99 |
+
" Lorsque le document est inférieur à une certaine largeur, le "
|
100 |
+
"document indique seulement en tant que \"vignette\" avec un grand\n"
|
101 |
+
" bouton 'Voir en plein écran' pour que votre\n"
|
102 |
+
" utilisateur puisse cliquer quand ils veulent consulter votre "
|
103 |
+
"document.\n"
|
104 |
+
" Cela ouvre le document de sorte qu'il a la pleine attention du "
|
105 |
+
"navigateur mobile, et l'utilisateur peut se déplacer dans le\n"
|
106 |
+
" document sans cliquer d'autres parties de\n"
|
107 |
+
" la page Web par erreur. Cliquer sur Quitter pour revenir à la "
|
108 |
+
"page Web principale."
|
109 |
+
|
110 |
+
#: basic_pdf_embedder.php:129 core/core_pdf_embedder.php:335
|
111 |
+
msgid ""
|
112 |
+
"See our website <a href=\"%s\">wp-pdf.com</a> for more details and purchase "
|
113 |
+
"options."
|
114 |
+
msgstr ""
|
115 |
+
"Consultez notre site Web <a href=\"%s\">wp-pdf.com</a> pour plus de détails "
|
116 |
+
"et d'options d'achat."
|
117 |
+
|
118 |
+
#: basic_pdf_embedder.php:175
|
119 |
+
msgid ""
|
120 |
+
"Track downloads and views with <a href=\"%s\" target=\"_blank\">PDF Embedder "
|
121 |
+
"Premium</a>"
|
122 |
+
msgstr ""
|
123 |
+
"Tracer les téléchargements et les vues avec <a href=\"%s\" target=\"_blank"
|
124 |
+
"\">PDF Embedder Premium</a>"
|
125 |
+
|
126 |
+
#: basic_pdf_embedder.php:177
|
127 |
+
msgid "Downloads/Views"
|
128 |
+
msgstr "Téléchargements / Vues"
|
129 |
+
|
130 |
+
#: core/EDD_SL_Plugin_Updater.php:248
|
131 |
+
msgid ""
|
132 |
+
"There is a new version of %1$s available. <a target=\"_blank\" class="
|
133 |
+
"\"thickbox\" href=\"%2$s\">View version %3$s details</a>."
|
134 |
+
msgstr ""
|
135 |
+
"Il y a une nouvelle version de %1$s disponible. <a target=\"_blank\" class="
|
136 |
+
"\"thickbox\" href=\"%2$s\">Voir les détails de la version %3$s</a>."
|
137 |
+
|
138 |
+
#: core/EDD_SL_Plugin_Updater.php:255
|
139 |
+
msgid ""
|
140 |
+
"There is a new version of %1$s available. <a target=\"_blank\" class="
|
141 |
+
"\"thickbox\" href=\"%2$s\">View version %3$s details</a> or <a href=\"%4$s"
|
142 |
+
"\">update now</a>."
|
143 |
+
msgstr ""
|
144 |
+
"Il y a une nouvelle version de %1$s disponible. <a target=\"_blank\" class="
|
145 |
+
"\"thickbox\" href=\"%2$s\">Voir les détails de la version %3$s</a> ou <a "
|
146 |
+
"href=\"%4$s\">mettre à jour maintenant</a>."
|
147 |
+
|
148 |
+
#: core/EDD_SL_Plugin_Updater.php:479
|
149 |
+
msgid "You do not have permission to install plugin updates"
|
150 |
+
msgstr "Vous n'êtes pas autorisé à installer les mises à jour du plugin"
|
151 |
+
|
152 |
+
#: core/EDD_SL_Plugin_Updater.php:479
|
153 |
+
msgid "Error"
|
154 |
+
msgstr "Erreur"
|
155 |
+
|
156 |
+
#: core/commercial_pdf_embedder.php:53
|
157 |
+
msgid "License"
|
158 |
+
msgstr "License"
|
159 |
+
|
160 |
+
#: core/commercial_pdf_embedder.php:67
|
161 |
+
msgid "Check to provide PDF download button in toolbar"
|
162 |
+
msgstr ""
|
163 |
+
"Vérifiez la présence du bouton de téléchargement de PDF dans la barre "
|
164 |
+
"d'outils"
|
165 |
+
|
166 |
+
#: core/commercial_pdf_embedder.php:76
|
167 |
+
msgid ""
|
168 |
+
"Count number of views and downloads (figures will be shown in <a href=\"%s"
|
169 |
+
"\">Media Library</a>)"
|
170 |
+
msgstr ""
|
171 |
+
"Compter le nombre de vues et téléchargements (les chiffres seront présentés "
|
172 |
+
"dans la <a href=\"%s\">Bibliothèque Médias </a>)"
|
173 |
+
|
174 |
+
#: core/commercial_pdf_embedder.php:104
|
175 |
+
msgid "Default Mobile Settings"
|
176 |
+
msgstr "Paramètres mobiles par défaut"
|
177 |
+
|
178 |
+
#: core/commercial_pdf_embedder.php:106
|
179 |
+
msgid ""
|
180 |
+
"When the document is smaller than the width specified below, the document "
|
181 |
+
"displays only as a 'thumbnail' with a large 'View in Full Screen' button for "
|
182 |
+
"the user to click to open."
|
183 |
+
msgstr ""
|
184 |
+
"Lorsque le document est plus petite que la largeur spécifiée ci-dessous, le "
|
185 |
+
"document s'affiche uniquement comme une 'miniature' avec un grand bouton "
|
186 |
+
"'Voir en plein écran' pour que l'utilisateur clique pour ouvrir."
|
187 |
+
|
188 |
+
#: core/commercial_pdf_embedder.php:108
|
189 |
+
msgid "Mobile Width"
|
190 |
+
msgstr "Largeur mobile"
|
191 |
+
|
192 |
+
#: core/commercial_pdf_embedder.php:112
|
193 |
+
msgid ""
|
194 |
+
"Enter an integer number of pixels, or 0 to disable automatic full-screen"
|
195 |
+
msgstr ""
|
196 |
+
"Entrez un nombre entier de pixels, ou 0 pour désactiver automatique le plein "
|
197 |
+
"écran"
|
198 |
+
|
199 |
+
#: core/commercial_pdf_embedder.php:116
|
200 |
+
msgid "Disable Device Zoom"
|
201 |
+
msgstr "Désactiver le Zoom"
|
202 |
+
|
203 |
+
#: core/commercial_pdf_embedder.php:119
|
204 |
+
msgid "Enable if you are experiencing quality issues on mobiles"
|
205 |
+
msgstr "Activer si vous rencontrez des problèmes de qualité sur les mobiles"
|
206 |
+
|
207 |
+
#: core/commercial_pdf_embedder.php:124
|
208 |
+
msgid ""
|
209 |
+
"Some mobile browsers will use their own zoom, causing the PDF Embedder to "
|
210 |
+
"render at a lower resolution than it should, or lose the toolbar off screen."
|
211 |
+
msgstr ""
|
212 |
+
"Certains navigateurs mobiles vont utiliser leur propre zoom, PDF Embedder "
|
213 |
+
"peut alors afficher une résolution inférieure à ce qu'elle devrait, ou "
|
214 |
+
"perdre la barre d'outils hors de l'écran."
|
215 |
+
|
216 |
+
#: core/commercial_pdf_embedder.php:125
|
217 |
+
msgid ""
|
218 |
+
"Enabling this option may help, but could potentially affect appearance in "
|
219 |
+
"the rest of your site."
|
220 |
+
msgstr ""
|
221 |
+
"L'activation de cette option peut aider, mais pourrait potentiellement "
|
222 |
+
"affecter l'apparence dans le reste de votre site."
|
223 |
+
|
224 |
+
#: core/commercial_pdf_embedder.php:126
|
225 |
+
msgid "See <a href=\"%s\" target=\"_blank\">documentation</a> for details."
|
226 |
+
msgstr ""
|
227 |
+
"Voir la <a href=\"%s\" target=\"_blank\">documentation</a> pour plus de "
|
228 |
+
"détails."
|
229 |
+
|
230 |
+
#: core/commercial_pdf_embedder.php:137
|
231 |
+
msgid ""
|
232 |
+
"You should have received a license key when you purchased this premium "
|
233 |
+
"version of PDF Embedder."
|
234 |
+
msgstr ""
|
235 |
+
"Vous devriez avoir reçu une clé de licence lorsque vous avez acheté cette "
|
236 |
+
"version premium de PDF Embedder."
|
237 |
+
|
238 |
+
#: core/commercial_pdf_embedder.php:138
|
239 |
+
msgid ""
|
240 |
+
"Please enter it below to enable automatic updates, or <a href=\"%s\">email "
|
241 |
+
"us</a> if you do not have one."
|
242 |
+
msgstr ""
|
243 |
+
"Veuillez valider ci-dessous pour activer les mises à jour automatiques, ou "
|
244 |
+
"<a href=\"%s\">envoyez nous un mail</a> si vous ne l'avez pas."
|
245 |
+
|
246 |
+
#: core/commercial_pdf_embedder.php:140
|
247 |
+
msgid "License Key"
|
248 |
+
msgstr "Clé de licence"
|
249 |
+
|
250 |
+
#: core/commercial_pdf_embedder.php:153
|
251 |
+
msgid "Current License"
|
252 |
+
msgstr "Licence actuelle"
|
253 |
+
|
254 |
+
#: core/commercial_pdf_embedder.php:156
|
255 |
+
msgid "Status"
|
256 |
+
msgstr "Statut"
|
257 |
+
|
258 |
+
#: core/commercial_pdf_embedder.php:160
|
259 |
+
msgid "Last Checked"
|
260 |
+
msgstr "Dernière vérification"
|
261 |
+
|
262 |
+
#: core/commercial_pdf_embedder.php:168
|
263 |
+
msgid "License Expires"
|
264 |
+
msgstr "Licence Expirée"
|
265 |
+
|
266 |
+
#: core/commercial_pdf_embedder.php:180
|
267 |
+
msgid ""
|
268 |
+
"To renew your license, please <a href=\"%s\" target=\"_blank\">click here</"
|
269 |
+
"a>."
|
270 |
+
msgstr ""
|
271 |
+
"Pour renouveler votre licence, veuillez <a href=\"%s\" target=\"_blank"
|
272 |
+
"\">cliquer ici</a>."
|
273 |
+
|
274 |
+
#: core/commercial_pdf_embedder.php:183
|
275 |
+
msgid ""
|
276 |
+
"You will receive a 50% discount if you renew before your license expires."
|
277 |
+
msgstr ""
|
278 |
+
"Vous recevrez une remise de 50% si vous renouvelez avant l'expiration de "
|
279 |
+
"votre licence."
|
280 |
+
|
281 |
+
#: core/commercial_pdf_embedder.php:309
|
282 |
+
msgid "Mobile width should be an integer number of pixels, or 0 to turn off"
|
283 |
+
msgstr ""
|
284 |
+
"La largeur du mobile doit être un nombre entier de pixels, ou 0 pour "
|
285 |
+
"désactiver"
|
286 |
+
|
287 |
+
#: core/commercial_pdf_embedder.php:310
|
288 |
+
msgid "License key is too short"
|
289 |
+
msgstr "La clé de licence est trop court"
|
290 |
+
|
291 |
+
#: core/commercial_pdf_embedder.php:312
|
292 |
+
msgid "License key failed to activate"
|
293 |
+
msgstr "Echec d'activation de la clef de Licence"
|
294 |
+
|
295 |
+
#: core/commercial_pdf_embedder.php:313
|
296 |
+
msgid "License key does not exist in our system at all"
|
297 |
+
msgstr "La clé de licence n'existe pas dans notre système"
|
298 |
+
|
299 |
+
#: core/commercial_pdf_embedder.php:314
|
300 |
+
msgid "License key entered is for the wrong product"
|
301 |
+
msgstr "La clé de licence est entrée pour le mauvais produit"
|
302 |
+
|
303 |
+
#: core/commercial_pdf_embedder.php:315
|
304 |
+
msgid "License key has expired"
|
305 |
+
msgstr "La clé de licence a expiré"
|
306 |
+
|
307 |
+
#: core/commercial_pdf_embedder.php:316
|
308 |
+
msgid "License key is not permitted for this website"
|
309 |
+
msgstr "La clé de licence n'est pas autorisée pour ce site"
|
310 |
+
|
311 |
+
#: core/commercial_pdf_embedder.php:317
|
312 |
+
msgid "License key is not active for this website"
|
313 |
+
msgstr "La clé de licence n'est pas active pour ce site"
|
314 |
+
|
315 |
+
#: core/commercial_pdf_embedder.php:318
|
316 |
+
msgid "License key has been disabled"
|
317 |
+
msgstr "La clé de licence a été désactivée"
|
318 |
+
|
319 |
+
#: core/commercial_pdf_embedder.php:319
|
320 |
+
msgid "License key was not provided"
|
321 |
+
msgstr "La clé de licence n'a pas été fourni"
|
322 |
+
|
323 |
+
#: core/commercial_pdf_embedder.php:361
|
324 |
+
msgid "Downloads"
|
325 |
+
msgstr "Téléchargements"
|
326 |
+
|
327 |
+
#: core/commercial_pdf_embedder.php:365
|
328 |
+
msgid "Views"
|
329 |
+
msgstr "Vues"
|
330 |
+
|
331 |
+
#: core/core_pdf_embedder.php:37
|
332 |
+
msgid "Loading..."
|
333 |
+
msgstr "Chargement..."
|
334 |
+
|
335 |
+
#: core/core_pdf_embedder.php:38
|
336 |
+
msgid "Page"
|
337 |
+
msgstr "Page"
|
338 |
+
|
339 |
+
#: core/core_pdf_embedder.php:39
|
340 |
+
msgid "Zoom"
|
341 |
+
msgstr "Zoom"
|
342 |
+
|
343 |
+
#: core/core_pdf_embedder.php:40
|
344 |
+
msgid "Previous page"
|
345 |
+
msgstr "Page précédente"
|
346 |
+
|
347 |
+
#: core/core_pdf_embedder.php:41
|
348 |
+
msgid "Next page"
|
349 |
+
msgstr "Page suivante"
|
350 |
+
|
351 |
+
#: core/core_pdf_embedder.php:42
|
352 |
+
msgid "Zoom In"
|
353 |
+
msgstr "Zoom +"
|
354 |
+
|
355 |
+
#: core/core_pdf_embedder.php:43
|
356 |
+
msgid "Zoom Out"
|
357 |
+
msgstr "Zoom -"
|
358 |
+
|
359 |
+
#: core/core_pdf_embedder.php:44 core/core_pdf_embedder.php:211
|
360 |
+
msgid "Secure"
|
361 |
+
msgstr "Sécurité"
|
362 |
+
|
363 |
+
#: core/core_pdf_embedder.php:45
|
364 |
+
msgid "Download PDF"
|
365 |
+
msgstr "Télécharger le PDF"
|
366 |
+
|
367 |
+
#: core/core_pdf_embedder.php:46
|
368 |
+
msgid "Full Screen"
|
369 |
+
msgstr "Plein écran"
|
370 |
+
|
371 |
+
#: core/core_pdf_embedder.php:47
|
372 |
+
msgid ""
|
373 |
+
"Error: URL to the PDF file must be on exactly the same domain as the current "
|
374 |
+
"web page."
|
375 |
+
msgstr ""
|
376 |
+
"Erreur: l'URL du fichier PDF doit être exactement dans le même domaine que "
|
377 |
+
"la page Web actuelle."
|
378 |
+
|
379 |
+
#: core/core_pdf_embedder.php:48
|
380 |
+
msgid "Click here for more info"
|
381 |
+
msgstr "Cliquez ici pour en savoir plus"
|
382 |
+
|
383 |
+
#: core/core_pdf_embedder.php:49
|
384 |
+
msgid "PDF page width or height are invalid"
|
385 |
+
msgstr "Largeur ou hauteur de la page PDF ne sont pas valides"
|
386 |
+
|
387 |
+
#: core/core_pdf_embedder.php:50
|
388 |
+
msgid "View in Full Screen"
|
389 |
+
msgstr "Voir en plein écran"
|
390 |
+
|
391 |
+
#: core/core_pdf_embedder.php:68
|
392 |
+
msgid "PDFs"
|
393 |
+
msgstr "PDF"
|
394 |
+
|
395 |
+
#: core/core_pdf_embedder.php:68
|
396 |
+
msgid "Manage PDFs"
|
397 |
+
msgstr "Gérer les fichiers PDF"
|
398 |
+
|
399 |
+
#: core/core_pdf_embedder.php:68
|
400 |
+
msgid "PDF <span class=\"count\">(%s)</span>"
|
401 |
+
msgid_plural "PDFs <span class=\"count\">(%s)</span>"
|
402 |
+
msgstr[0] "PDF <span class=\"count\">(%s)</span>"
|
403 |
+
msgstr[1] "PDFs <span class=\"count\">(%s)</span>"
|
404 |
+
|
405 |
+
#: core/core_pdf_embedder.php:172 core/core_pdf_embedder.php:177
|
406 |
+
msgid "PDF Embedder settings"
|
407 |
+
msgstr "Paramètres PDF Embedder"
|
408 |
+
|
409 |
+
#: core/core_pdf_embedder.php:172 core/core_pdf_embedder.php:177
|
410 |
+
msgid "PDF Embedder"
|
411 |
+
msgstr "PDF Embedder"
|
412 |
+
|
413 |
+
#: core/core_pdf_embedder.php:197
|
414 |
+
msgid "PDF Embedder setup"
|
415 |
+
msgstr "Configuration PDF Embedder"
|
416 |
+
|
417 |
+
#: core/core_pdf_embedder.php:199
|
418 |
+
msgid ""
|
419 |
+
"To use the plugin, just embed PDFs in the same way as you would normally "
|
420 |
+
"embed images in your posts/pages - but try with a PDF file instead."
|
421 |
+
msgstr ""
|
422 |
+
"Pour utiliser le plug-in, incorporer des fichiers PDF de la même manière que "
|
423 |
+
"vous le feriez pour incorporer des images dans vos articles / pages - mais "
|
424 |
+
"essayez avec un fichier PDF à la place."
|
425 |
+
|
426 |
+
#: core/core_pdf_embedder.php:200
|
427 |
+
msgid ""
|
428 |
+
"From the post editor, click Add Media, and then drag-and-drop your PDF file "
|
429 |
+
"into the media library.\n"
|
430 |
+
" When you insert the PDF into your post, it will "
|
431 |
+
"automatically embed using the plugin's viewer."
|
432 |
+
msgstr ""
|
433 |
+
"A partir de l'éditeur de messages, cliquez sur Ajouter des médias, puis "
|
434 |
+
"faites glisser-déposer votre fichier PDF dans la bibliothèque multimédia.\n"
|
435 |
+
" Lorsque vous insérez le PDF dans votre message, il sera "
|
436 |
+
"automatiquement intégré à l'aide du visualiseur de plugin."
|
437 |
+
|
438 |
+
#: core/core_pdf_embedder.php:209
|
439 |
+
msgid "Main Settings"
|
440 |
+
msgstr "Paramètres Généraux"
|
441 |
+
|
442 |
+
#: core/core_pdf_embedder.php:210
|
443 |
+
msgid "Mobile"
|
444 |
+
msgstr "Mobile"
|
445 |
+
|
446 |
+
#: core/core_pdf_embedder.php:238
|
447 |
+
msgid "Save Changes"
|
448 |
+
msgstr "Sauvegarder les modifications"
|
449 |
+
|
450 |
+
#: core/core_pdf_embedder.php:266
|
451 |
+
msgid "Default Viewer Settings"
|
452 |
+
msgstr "Paramètres par défaut du Viewer"
|
453 |
+
|
454 |
+
#: core/core_pdf_embedder.php:268
|
455 |
+
msgid "Width"
|
456 |
+
msgstr "Largeur"
|
457 |
+
|
458 |
+
#: core/core_pdf_embedder.php:272
|
459 |
+
msgid "Height"
|
460 |
+
msgstr "Hauteur"
|
461 |
+
|
462 |
+
#: core/core_pdf_embedder.php:276
|
463 |
+
msgid "Enter <b>max</b> or an integer number of pixels"
|
464 |
+
msgstr "Entrez <b> max </ b> ou un nombre entier de pixels"
|
465 |
+
|
466 |
+
#: core/core_pdf_embedder.php:280
|
467 |
+
msgid "Toolbar Location"
|
468 |
+
msgstr "Position de la barre d'outils"
|
469 |
+
|
470 |
+
#: core/core_pdf_embedder.php:282
|
471 |
+
msgid "Top"
|
472 |
+
msgstr "Haut"
|
473 |
+
|
474 |
+
#: core/core_pdf_embedder.php:283
|
475 |
+
msgid "Bottom"
|
476 |
+
msgstr "Bas"
|
477 |
+
|
478 |
+
#: core/core_pdf_embedder.php:284
|
479 |
+
msgid "Both"
|
480 |
+
msgstr "Haut et bas"
|
481 |
+
|
482 |
+
#: core/core_pdf_embedder.php:289
|
483 |
+
msgid "Toolbar Hover"
|
484 |
+
msgstr "Barre d'outils flottante"
|
485 |
+
|
486 |
+
#: core/core_pdf_embedder.php:292
|
487 |
+
msgid "Toolbar appears only on hover over document"
|
488 |
+
msgstr ""
|
489 |
+
"La barre d'outils apparaît uniquement sur le vol stationnaire sur le document"
|
490 |
+
|
491 |
+
#: core/core_pdf_embedder.php:297
|
492 |
+
msgid "Toolbar always visible"
|
493 |
+
msgstr "Barre d'outils toujours visible"
|
494 |
+
|
495 |
+
#: core/core_pdf_embedder.php:309
|
496 |
+
msgid ""
|
497 |
+
"You can override these defaults for specific embeds by modifying the "
|
498 |
+
"shortcodes - see <a href=\"%s\" target=\"_blank\">instructions</a>."
|
499 |
+
msgstr ""
|
500 |
+
"Vous pouvez remplacer ces valeurs par défaut pour des intégrations "
|
501 |
+
"spécifiques en modifiant les shortcodes - voir les <a href=\"%s\" target="
|
502 |
+
"\"_blank\">instructions</a>"
|
503 |
+
|
504 |
+
#: core/core_pdf_embedder.php:329
|
505 |
+
msgid "Protect your PDFs using PDF Embedder Secure"
|
506 |
+
msgstr "Protégez vos fichiers PDF à l'aide de PDF Embedder sécurisé"
|
507 |
+
|
508 |
+
#: core/core_pdf_embedder.php:330
|
509 |
+
msgid ""
|
510 |
+
"Our <b>PDF Embedder Premium Secure</b> plugin provides the same simple but "
|
511 |
+
"elegant viewer for your website visitors, with the added protection that\n"
|
512 |
+
" it is difficult for users to download or print the original PDF "
|
513 |
+
"document."
|
514 |
+
msgstr ""
|
515 |
+
"Notre plugin<b>PDF Embedder Premium Sécurisé </b> fournit une interface "
|
516 |
+
"simple mais pratique pour les visiteurs de votre site Web, avec la "
|
517 |
+
"protection supplémentaire,\n"
|
518 |
+
" il est difficile pour les utilisateurs de télécharger ou "
|
519 |
+
"d'imprimer le document PDF d'origine."
|
520 |
+
|
521 |
+
#: core/core_pdf_embedder.php:333
|
522 |
+
msgid ""
|
523 |
+
"This means that your PDF is unlikely to be shared outside your site where "
|
524 |
+
"you have no control over who views, prints, or shares it."
|
525 |
+
msgstr ""
|
526 |
+
"Cela signifie que votre PDF est peu susceptible d'être partagé en dehors de "
|
527 |
+
"votre site où vous n'avez aucun contrôle sur qui vois, imprime, ou partage."
|
528 |
+
|
529 |
+
#: core/core_pdf_embedder.php:381
|
530 |
+
msgid "Width must be \"max\" or an integer (number of pixels)"
|
531 |
+
msgstr "Largeur doit être \"max\" ou un nombre entier (nombre de pixels)"
|
532 |
+
|
533 |
+
#: core/core_pdf_embedder.php:382
|
534 |
+
msgid "Height must be \"max\" or an integer (number of pixels)"
|
535 |
+
msgstr "Hauteur doit être \"max\" ou un nombre entier (nombre de pixels)"
|
536 |
+
|
537 |
+
#: core/core_pdf_embedder.php:388
|
538 |
+
msgid "Unspecified error"
|
539 |
+
msgstr "Erreur non spécifiée"
|
540 |
+
|
541 |
+
#: core/core_pdf_embedder.php:429
|
542 |
+
msgid "Settings saved"
|
543 |
+
msgstr "Paramètres sauvegardés"
|
544 |
+
|
545 |
+
#: core/core_pdf_embedder.php:525
|
546 |
+
msgid "Settings"
|
547 |
+
msgstr "Paramètres"
|
548 |
+
|
549 |
+
#: premium_secure_pdf_embedder.php:164 premium_secure_pdf_embedder.php:166
|
550 |
+
msgid "Secure PDFs"
|
551 |
+
msgstr "PDF sécurisés"
|
552 |
+
|
553 |
+
#: premium_secure_pdf_embedder.php:169
|
554 |
+
msgid "Send PDF media uploads to 'securepdfs' folder"
|
555 |
+
msgstr "Envoyer les PDF dans un dossier média 'securepdfs'"
|
556 |
+
|
557 |
+
#: premium_secure_pdf_embedder.php:175
|
558 |
+
msgid "Disable Right Click"
|
559 |
+
msgstr "Désactiver le Clic droit"
|
560 |
+
|
561 |
+
#: premium_secure_pdf_embedder.php:178
|
562 |
+
msgid "Disable right-click mouse menu"
|
563 |
+
msgstr "Désactiver le menu de la souris clic-droit"
|
564 |
+
|
565 |
+
#: premium_secure_pdf_embedder.php:185
|
566 |
+
msgid ""
|
567 |
+
"If 'Secure PDFs' is checked above, your PDF uploads will be 'secure' by "
|
568 |
+
"default.\n"
|
569 |
+
" That is, they should be uploaded to a 'securepdfs' sub-folder of "
|
570 |
+
"your uploads area. These files should not be accessible directly,\n"
|
571 |
+
" and the plugin provides a backdoor method for the embedded "
|
572 |
+
"viewer to obtain the file contents."
|
573 |
+
msgstr ""
|
574 |
+
"Si 'PDF sécurisés' est cochée ci-dessus, vos téléchargements de fichiers PDF "
|
575 |
+
"seront 'sécurisés' par défaut.\n"
|
576 |
+
" Autrement dit, ils doivent être téléchargés dans un sous-dossier "
|
577 |
+
"'securepdfs' de votre espace de téléchargement. Ces fichiers ne doivent pas "
|
578 |
+
"être accessibles directement,\n"
|
579 |
+
" et le plugin fournit une méthode de porte dérobée pour que le "
|
580 |
+
"Viewer affiche le contenu du fichier."
|
581 |
+
|
582 |
+
#: premium_secure_pdf_embedder.php:189
|
583 |
+
msgid ""
|
584 |
+
"This means that your PDF is unlikely to be shared outside your site where "
|
585 |
+
"you have no control over who views, prints, or shares it.\n"
|
586 |
+
" Please note that it is still always possible for a determined "
|
587 |
+
"user to obtain the original file. Sensitive information should never be "
|
588 |
+
"presented to viewers in any form."
|
589 |
+
msgstr ""
|
590 |
+
"Cela signifie que votre PDF est peu susceptible d'être partagé en dehors de "
|
591 |
+
"votre site où vous n'avez aucun contrôle sur qui vois, imprime, ou partage "
|
592 |
+
"les fichiers.\n"
|
593 |
+
" A noter qu'il est toujours possible pour un utilisateur "
|
594 |
+
"déterminé d'obtenir le fichier d'origine. Les informations sensibles ne "
|
595 |
+
"devraient jamais être présenté aux visiteurs sous quelque forme que ce soit."
|
596 |
+
|
597 |
+
#: premium_secure_pdf_embedder.php:192
|
598 |
+
msgid ""
|
599 |
+
"See <a href=\"http://wp-pdf.com/premium-instructions/?utm_source=PDF"
|
600 |
+
"%20Settings%20Secure&utm_medium=premium&utm_campaign=Premium\" target="
|
601 |
+
"\"_blank\">Instructions</a> for more details."
|
602 |
+
msgstr ""
|
603 |
+
"Voir les <a href=\"http://wp-pdf.com/premium-instructions/?utm_source=PDF"
|
604 |
+
"%20Settings%20Secure&utm_medium=premium&utm_campaign=Premium\" target="
|
605 |
+
"\"_blank\">Instructions</a> pour plus de détails."
|
606 |
+
|
607 |
+
# wordpress plugin description
|
608 |
+
msgid ""
|
609 |
+
"Embed PDFs straight into your posts and pages, with flexible width and "
|
610 |
+
"height. No third-party services required."
|
611 |
+
msgstr ""
|
612 |
+
"Intégration directe des PDF dans vos messages et pages, avec une largeur "
|
613 |
+
"flexible et hauteur. Aucun service tiers requis."
|
614 |
+
|
615 |
+
# readme description
|
616 |
+
msgid ""
|
617 |
+
"Embed PDFs straight into your posts and pages, with intelligent resizing of "
|
618 |
+
"width and height. No third-party services or iframes required."
|
619 |
+
msgstr ""
|
620 |
+
"Intégration direct des PDF dans vos messages et pages, avec "
|
621 |
+
"redimensionnement intelligent de la largeur et la hauteur. Pas de services "
|
622 |
+
"tiers ou iframes nécessaires."
|
623 |
+
|
624 |
+
# wordpress plugin description
|
625 |
+
msgid "PDF Embedder Premium"
|
626 |
+
msgstr "PDF Embedder Premium"
|
627 |
+
|
628 |
+
# wordpress plugin description
|
629 |
+
msgid "PDF Embedder Premium Secure"
|
630 |
+
msgstr "PDF Embedder Premium Sécurisé"
|
pdf_embedder.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: PDF Embedder
|
5 |
* Plugin URI: http://wp-pdf.com/
|
6 |
* Description: Embed PDFs straight into your posts and pages, with flexible width and height. No third-party services required.
|
7 |
-
* Version: 2.5
|
8 |
* Author: Dan Lester
|
9 |
* Author URI: http://wp-pdf.com/
|
10 |
* License: GPL3
|
@@ -15,7 +15,7 @@ require_once( plugin_dir_path(__FILE__).'/core/core_pdf_embedder.php' );
|
|
15 |
|
16 |
class pdfemb_basic_pdf_embedder extends core_pdf_embedder {
|
17 |
|
18 |
-
protected $PLUGIN_VERSION = '2.5';
|
19 |
|
20 |
protected function useminified() {
|
21 |
/* using-minified */ return true;
|
4 |
* Plugin Name: PDF Embedder
|
5 |
* Plugin URI: http://wp-pdf.com/
|
6 |
* Description: Embed PDFs straight into your posts and pages, with flexible width and height. No third-party services required.
|
7 |
+
* Version: 2.5.4
|
8 |
* Author: Dan Lester
|
9 |
* Author URI: http://wp-pdf.com/
|
10 |
* License: GPL3
|
15 |
|
16 |
class pdfemb_basic_pdf_embedder extends core_pdf_embedder {
|
17 |
|
18 |
+
protected $PLUGIN_VERSION = '2.5.4';
|
19 |
|
20 |
protected function useminified() {
|
21 |
/* using-minified */ return true;
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: danlester
|
3 |
Tags: doc, docx, pdf, office, powerpoint, google, document, embed, intranet
|
4 |
Requires at least: 3.5
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 2.5
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -11,6 +11,9 @@ Embed PDFs straight into your posts and pages, with intelligent resizing of widt
|
|
11 |
|
12 |
== Description ==
|
13 |
|
|
|
|
|
|
|
14 |
Upload PDFs and embed them straight into your site - just like adding images! PDFs will be automatically sized to their natural size and shape (or just fill the width available if they are too big). Optionally, you can specify a width and the correct height will be calculated automatically. The shape will be recalculated whenever the page is resized by the user.
|
15 |
|
16 |
The plugin has a unique method for embedding PDFs, using Javascript only, and _not_ using iframes or third-party services. This gives a lot of flexibility over the appearance of your document.
|
@@ -26,6 +29,8 @@ Hyperlinks in your PDF will only be clickable in the Premium versions.
|
|
26 |
|
27 |
**Now translation-ready!** Please contribute your translations.
|
28 |
|
|
|
|
|
29 |
= Usage =
|
30 |
|
31 |
Once installed and Activated, click Add Media from any page or post, just like adding an image, but drag and drop a PDF file instead.
|
@@ -162,6 +167,11 @@ the Plugins section of your Wordpress admin
|
|
162 |
|
163 |
== Changelog ==
|
164 |
|
|
|
|
|
|
|
|
|
|
|
165 |
= 2.5 =
|
166 |
|
167 |
Uses latest version of pdf.js library for rendering PDFs.
|
2 |
Contributors: danlester
|
3 |
Tags: doc, docx, pdf, office, powerpoint, google, document, embed, intranet
|
4 |
Requires at least: 3.5
|
5 |
+
Tested up to: 4.5
|
6 |
+
Stable tag: 2.5.4
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
> Problems after upgrading to WordPress 4.5? Almost certainly, your other Themes and Plugins need updating. Please install all updates and then get in touch with us
|
15 |
+
> or your Theme author if PDF Embedder still isn't working.
|
16 |
+
|
17 |
Upload PDFs and embed them straight into your site - just like adding images! PDFs will be automatically sized to their natural size and shape (or just fill the width available if they are too big). Optionally, you can specify a width and the correct height will be calculated automatically. The shape will be recalculated whenever the page is resized by the user.
|
18 |
|
19 |
The plugin has a unique method for embedding PDFs, using Javascript only, and _not_ using iframes or third-party services. This gives a lot of flexibility over the appearance of your document.
|
29 |
|
30 |
**Now translation-ready!** Please contribute your translations.
|
31 |
|
32 |
+
French translation contributed by Thierry Gaillou of [JDFitForme](http://www.jdfitforme.fr/) - Thank you!
|
33 |
+
|
34 |
= Usage =
|
35 |
|
36 |
Once installed and Activated, click Add Media from any page or post, just like adding an image, but drag and drop a PDF file instead.
|
167 |
|
168 |
== Changelog ==
|
169 |
|
170 |
+
= 2.5.4 =
|
171 |
+
|
172 |
+
Added French translation thanks to Thierry Gaillou of JDFitForme.
|
173 |
+
Uses newer version of pdf.js library for rendering PDFs.
|
174 |
+
|
175 |
= 2.5 =
|
176 |
|
177 |
Uses latest version of pdf.js library for rendering PDFs.
|