Version Description
Fix for a small number of PDFs rendering as smaller than expected on some high resolution screens.
Download this release
Release Info
Developer | danlester |
Plugin | PDF Embedder |
Version | 2.7.5 |
Comparing to | |
See all releases |
Code changes from version 2.7.3 to 2.7.5
- css/pdfemb-embed-pdf.css +1 -0
- js/all-pdfemb-basic.min.js +4 -4
- js/pdfemb-embed-pdf.js +8 -8
- pdf_embedder.php +3 -2
- readme.txt +6 -2
css/pdfemb-embed-pdf.css
CHANGED
@@ -153,6 +153,7 @@ div.pdfemb-toolbar button, div.pdfemb-toolbar button[disabled] {
|
|
153 |
|
154 |
min-width: 16px;
|
155 |
padding: 2px 6px 0;
|
|
|
156 |
|
157 |
border-radius: 2px;
|
158 |
color: hsla(0,0%,100%,.8);
|
153 |
|
154 |
min-width: 16px;
|
155 |
padding: 2px 6px 0;
|
156 |
+
width: auto;
|
157 |
|
158 |
border-radius: 2px;
|
159 |
color: hsla(0,0%,100%,.8);
|
js/all-pdfemb-basic.min.js
CHANGED
@@ -14,10 +14,10 @@ PDFJS.getDocument(a).then(function(a){h(a,d)},function(a){var d=document.createT
|
|
14 |
(f=b.data("pdf-url"),pdfembGetPDF(f,e))});return this};c.fn.pdfEmbedder.annotationsLayerFactory="undefined"!=typeof pdfembPremiumAnnotationsLayerFactory?new pdfembPremiumAnnotationsLayerFactory:{createAnnotationsLayerBuilder:function(a,c){return null}};c.fn.pdfEmbedder.checkForResize=function(a){var d=c(window).height(),b=c(window).width(),e=a.data("checked-window-height"),f=a.data("checked-window-width");if(!e||!f)a.data("checked-window-height",d),a.data("checked-window-width",b);else if(e!=d||f!=
|
15 |
b)c.fn.pdfEmbedder.queueRenderPage(a,a.data("pagenum")),a.data("checked-window-height",d),a.data("checked-window-width",b);"true"!=a.data("fullScreenClosed")&&setTimeout(function(){c.fn.pdfEmbedder.checkForResize(a)},1E3)};c.fn.pdfEmbedder.renderPage=function(a,d,b){a.data("pageRendering",!0);a.data("pdfDoc").getPage(d).then(function(e){var f=a.find(".pdfemb-the-canvas"),y=null,r=null,u=null,v=null;b&&(u=f.width(),v=f.height(),r=f[0].getContext("2d"),y=r.getImageData(0,0,u*h,v*h));var n,g=e.getViewport(1),
|
16 |
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")?a.parent().height()-
|
17 |
-
t*w.height():p;var g=Math.floor(g),p=Math.floor(p),x=100,l=g,m=p,A=0,B=0;q||(x=a.data("zoom"),l=g*x/100,m=p*x/100,l<g&&(A=(g-l)/2),m<k&&(B=(k-m)/2));var C=e.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 E=n[0].scrollLeft,z=n[0].scrollTop;n.width(g);n.height(k);w=w.filter(".pdfemb-toolbar-top");0<t&&n.css("top",w.height());f[0].width=l*h;f[0].height=m*h;f.css("width",l);f.css("height",m);f
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
var b=c.fn.pdfEmbedder.annotationsLayerFactory.createAnnotationsLayerBuilder(a.find("div.pdfemb-inner-div")[0],e);null!=b&&(a.find("div.pdfembAnnotationLayer").remove(),b.setupAnnotations(C,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,d,b){a.data("pageRendering")?a.data("pageNumPending",d):c.fn.pdfEmbedder.renderPage(a,d,b)};c.fn.pdfEmbedder.goFullScreen=
|
22 |
function(a){a=c('<div class="pdfemb-fs-window"></div>');c(document.body).append(a)};c.fn.pdfEmbedder.changeZoom=function(a,d){var b=a.data("zoom"),e=b+d;a.data("zoom",e);a.find("span.pdfemb-zoom").text(e+"%");c.fn.pdfEmbedder.queueRenderPage(a,a.data("pagenum"));a.data("fromZoom",b).data("toZoom",e)};c.fn.pdfEmbedder.magnifyZoom=function(a,d){var b=a.data("zoom"),e=Math.floor(b*d);20>e&&(e=20);500<e&&(e=500);a.data("zoom",e);a.find("span.pdfemb-zoom").text(e+"%");c.fn.pdfEmbedder.queueRenderPage(a,
|
23 |
a.data("pagenum"),!0);a.data("fromZoom",b).data("toZoom",e)};c.fn.pdfEmbedder.addToolbar=function(a,d,b,e){var f=c("<div></div>",{"class":"pdfemb-toolbar pdfemb-toolbar"+(b?"-fixed":"-hover")+" "+(d?" pdfemb-toolbar-top":"pdfemb-toolbar-bottom")}),h=c('<button class="pdfemb-prev" title="'+pdfemb_trans.objectL10n.prev+'" type="button"></button>');f.append(h);var r=c('<button class="pdfemb-next" title="'+pdfemb_trans.objectL10n.next+'" type="button"></button>');f.append(r);f.append(c('<div class="pdfemb-page-area">'+
|
14 |
(f=b.data("pdf-url"),pdfembGetPDF(f,e))});return this};c.fn.pdfEmbedder.annotationsLayerFactory="undefined"!=typeof pdfembPremiumAnnotationsLayerFactory?new pdfembPremiumAnnotationsLayerFactory:{createAnnotationsLayerBuilder:function(a,c){return null}};c.fn.pdfEmbedder.checkForResize=function(a){var d=c(window).height(),b=c(window).width(),e=a.data("checked-window-height"),f=a.data("checked-window-width");if(!e||!f)a.data("checked-window-height",d),a.data("checked-window-width",b);else if(e!=d||f!=
|
15 |
b)c.fn.pdfEmbedder.queueRenderPage(a,a.data("pagenum")),a.data("checked-window-height",d),a.data("checked-window-width",b);"true"!=a.data("fullScreenClosed")&&setTimeout(function(){c.fn.pdfEmbedder.checkForResize(a)},1E3)};c.fn.pdfEmbedder.renderPage=function(a,d,b){a.data("pageRendering",!0);a.data("pdfDoc").getPage(d).then(function(e){var f=a.find(".pdfemb-the-canvas"),y=null,r=null,u=null,v=null;b&&(u=f.width(),v=f.height(),r=f[0].getContext("2d"),y=r.getImageData(0,0,u*h,v*h));var n,g=e.getViewport(1),
|
16 |
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")?a.parent().height()-
|
17 |
+
t*w.height():p;var g=Math.floor(g),p=Math.floor(p),x=100,l=g,m=p,A=0,B=0;q||(x=a.data("zoom"),l=g*x/100,m=p*x/100,l<g&&(A=(g-l)/2),m<k&&(B=(k-m)/2));var C=e.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 E=n[0].scrollLeft,z=n[0].scrollTop;n.width(g);n.height(k);w=w.filter(".pdfemb-toolbar-top");0<t&&n.css("top",w.height());f[0].width=l*h;f[0].height=m*h;f.css("width",l);f.css("height",m);f.css("left",A).css("top",B);(l>g||
|
18 |
+
m>p||m>k)&&!q?(k=a.data("fromZoom"),t=a.data("toZoom"),0<k&&0<t&&(z+=p/2,n.scrollLeft((E+g/2)*t/k-g/2),n.scrollTop(z*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);if(b)a.data("pagenum",d),a.data("pageRendering",!1),f=c("<canvas>").attr("width",y.width).attr("height",y.height)[0],f.getContext("2d").putImageData(y,
|
19 |
+
0,0),r.scale(l/u,m/v),r.drawImage(f,0,0);else{var D=f[0].getContext("2d");e.render({canvasContext:D,viewport:C,transform:[h,0,0,h,0,0]}).promise.then(function(){"function"==typeof pdfembPremiumPreRenderCanvas&&c.isArray(pdfemb_trans.watermark_map)&&0<pdfemb_trans.watermark_map.length&&(-1==a.data("pdf-url").search("/?pdfemb-serveurl=")||"undefined"!=typeof pdfemb_trans.watermark_evenpagesonly&&pdfemb_trans.watermark_evenpagesonly&&0!=d%2||pdfembPremiumPreRenderCanvas(c,D,pdfemb_trans.watermark_map,
|
20 |
+
x));a.data("pagenum",d);a.data("pageRendering",!1);a.find("div.pdfemb-toolbar .pdfemb-page-num").each(function(a,b){var e=c(b);e.is("span")?e.text(d):e.val(d)});d<a.data("pageCount")?a.find(".pdfemb-next").removeAttr("disabled").removeClass("pdfemb-btndisabled"):a.find(".pdfemb-next").attr("disabled","disabled").addClass("pdfemb-btndisabled");1<d?a.find(".pdfemb-prev").removeAttr("disabled").removeClass("pdfemb-btndisabled"):a.find(".pdfemb-prev").attr("disabled","disabled").addClass("pdfemb-btndisabled");
|
21 |
var b=c.fn.pdfEmbedder.annotationsLayerFactory.createAnnotationsLayerBuilder(a.find("div.pdfemb-inner-div")[0],e);null!=b&&(a.find("div.pdfembAnnotationLayer").remove(),b.setupAnnotations(C,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,d,b){a.data("pageRendering")?a.data("pageNumPending",d):c.fn.pdfEmbedder.renderPage(a,d,b)};c.fn.pdfEmbedder.goFullScreen=
|
22 |
function(a){a=c('<div class="pdfemb-fs-window"></div>');c(document.body).append(a)};c.fn.pdfEmbedder.changeZoom=function(a,d){var b=a.data("zoom"),e=b+d;a.data("zoom",e);a.find("span.pdfemb-zoom").text(e+"%");c.fn.pdfEmbedder.queueRenderPage(a,a.data("pagenum"));a.data("fromZoom",b).data("toZoom",e)};c.fn.pdfEmbedder.magnifyZoom=function(a,d){var b=a.data("zoom"),e=Math.floor(b*d);20>e&&(e=20);500<e&&(e=500);a.data("zoom",e);a.find("span.pdfemb-zoom").text(e+"%");c.fn.pdfEmbedder.queueRenderPage(a,
|
23 |
a.data("pagenum"),!0);a.data("fromZoom",b).data("toZoom",e)};c.fn.pdfEmbedder.addToolbar=function(a,d,b,e){var f=c("<div></div>",{"class":"pdfemb-toolbar pdfemb-toolbar"+(b?"-fixed":"-hover")+" "+(d?" pdfemb-toolbar-top":"pdfemb-toolbar-bottom")}),h=c('<button class="pdfemb-prev" title="'+pdfemb_trans.objectL10n.prev+'" type="button"></button>');f.append(h);var r=c('<button class="pdfemb-next" title="'+pdfemb_trans.objectL10n.next+'" type="button"></button>');f.append(r);f.append(c('<div class="pdfemb-page-area">'+
|
js/pdfemb-embed-pdf.js
CHANGED
@@ -422,8 +422,6 @@ jQuery(document).ready(function ($) {
|
|
422 |
canvas.css('width', wantCanvasWidth);
|
423 |
canvas.css('height', wantCanvasHeight);
|
424 |
|
425 |
-
canvas[0].getContext("2d").setTransform(PIXEL_RATIO, 0, 0, PIXEL_RATIO, 0, 0);
|
426 |
-
|
427 |
canvas.css('left', canvasHMargin).css('top', canvasVMargin);
|
428 |
|
429 |
// Need to pan?
|
@@ -469,15 +467,11 @@ jQuery(document).ready(function ($) {
|
|
469 |
.attr("width", canvasImg.width)
|
470 |
.attr("height", canvasImg.height)[0];
|
471 |
|
472 |
-
// newCanvas.getContext("2d").setTransform(PIXEL_RATIO, 0, 0, PIXEL_RATIO, 0, 0);
|
473 |
-
|
474 |
newCanvas.getContext("2d").putImageData(canvasImg, 0, 0);
|
475 |
|
476 |
-
canvasCxt.scale(wantCanvasWidth/(oldCanvasWidth
|
477 |
canvasCxt.drawImage(newCanvas, 0, 0);
|
478 |
|
479 |
-
|
480 |
-
|
481 |
return;
|
482 |
}
|
483 |
|
@@ -485,8 +479,14 @@ jQuery(document).ready(function ($) {
|
|
485 |
var ctx = canvas[0].getContext('2d');
|
486 |
var renderContext = {
|
487 |
canvasContext: ctx,
|
488 |
-
viewport: viewport
|
|
|
489 |
};
|
|
|
|
|
|
|
|
|
|
|
490 |
var renderTask = page.render(renderContext);
|
491 |
|
492 |
// Wait for rendering to finish
|
422 |
canvas.css('width', wantCanvasWidth);
|
423 |
canvas.css('height', wantCanvasHeight);
|
424 |
|
|
|
|
|
425 |
canvas.css('left', canvasHMargin).css('top', canvasVMargin);
|
426 |
|
427 |
// Need to pan?
|
467 |
.attr("width", canvasImg.width)
|
468 |
.attr("height", canvasImg.height)[0];
|
469 |
|
|
|
|
|
470 |
newCanvas.getContext("2d").putImageData(canvasImg, 0, 0);
|
471 |
|
472 |
+
canvasCxt.scale(wantCanvasWidth/(oldCanvasWidth), wantCanvasHeight/(oldCanvasHeight));
|
473 |
canvasCxt.drawImage(newCanvas, 0, 0);
|
474 |
|
|
|
|
|
475 |
return;
|
476 |
}
|
477 |
|
479 |
var ctx = canvas[0].getContext('2d');
|
480 |
var renderContext = {
|
481 |
canvasContext: ctx,
|
482 |
+
viewport: viewport,
|
483 |
+
transform: [PIXEL_RATIO, 0, 0, PIXEL_RATIO, 0, 0]
|
484 |
};
|
485 |
+
|
486 |
+
// No longer set transform on ctx explicitly
|
487 |
+
// ctx.setTransform(PIXEL_RATIO, 0, 0, PIXEL_RATIO, 0, 0);
|
488 |
+
// This was not always being picked up first time on some browsers - set via renderContext instead above
|
489 |
+
|
490 |
var renderTask = page.render(renderContext);
|
491 |
|
492 |
// Wait for rendering to finish
|
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.7.
|
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.7.
|
19 |
|
20 |
protected function useminified() {
|
21 |
/* using-minified */ return true;
|
@@ -140,6 +140,7 @@ class pdfemb_basic_pdf_embedder extends core_pdf_embedder {
|
|
140 |
<ul>
|
141 |
<li>Mobile Friendly</li>
|
142 |
<li>Download Button</li>
|
|
|
143 |
<li>Working Hyperlinks</li>
|
144 |
<li>Jump to page number</li>
|
145 |
<li>Track views and downloads</li>
|
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.7.5
|
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.7.5';
|
19 |
|
20 |
protected function useminified() {
|
21 |
/* using-minified */ return true;
|
140 |
<ul>
|
141 |
<li>Mobile Friendly</li>
|
142 |
<li>Download Button</li>
|
143 |
+
<li>Full screen button</li>
|
144 |
<li>Working Hyperlinks</li>
|
145 |
<li>Jump to page number</li>
|
146 |
<li>Track views and downloads</li>
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ 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
|
6 |
-
Stable tag: 2.7.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -27,7 +27,6 @@ Hyperlinks in your PDF will only be clickable in the Premium versions.
|
|
27 |
**Now translation-ready!** Please contribute your translations.
|
28 |
|
29 |
French translation contributed by Thierry Gaillou of [JDFitForme](http://www.jdfitforme.fr/)
|
30 |
-
|
31 |
Spanish translation contributed by Armando Landois of [LANDOIS Diseño](https://landois.com/)
|
32 |
|
33 |
|
@@ -47,6 +46,7 @@ To override your site-wide defaults on an individual embed, see the [Plugin Inst
|
|
47 |
>
|
48 |
> * Download button in the toolbar.
|
49 |
> * Hyperlinks are fully functional.
|
|
|
50 |
> * Edit page number to jump straight to page.
|
51 |
> * Track number of downloads and views.
|
52 |
> * Removes wp-pdf.com attribution from the toolbar.
|
@@ -171,6 +171,10 @@ the Plugins section of your Wordpress admin
|
|
171 |
|
172 |
== Changelog ==
|
173 |
|
|
|
|
|
|
|
|
|
174 |
= 2.7.3 =
|
175 |
|
176 |
**Please clear browser and any WordPress cache if you experience any problems following this upgrade.**
|
3 |
Tags: doc, docx, pdf, office, powerpoint, google, document, embed, intranet
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 4.6
|
6 |
+
Stable tag: 2.7.5
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
27 |
**Now translation-ready!** Please contribute your translations.
|
28 |
|
29 |
French translation contributed by Thierry Gaillou of [JDFitForme](http://www.jdfitforme.fr/)
|
|
|
30 |
Spanish translation contributed by Armando Landois of [LANDOIS Diseño](https://landois.com/)
|
31 |
|
32 |
|
46 |
>
|
47 |
> * Download button in the toolbar.
|
48 |
> * Hyperlinks are fully functional.
|
49 |
+
> * Full screen mode.
|
50 |
> * Edit page number to jump straight to page.
|
51 |
> * Track number of downloads and views.
|
52 |
> * Removes wp-pdf.com attribution from the toolbar.
|
171 |
|
172 |
== Changelog ==
|
173 |
|
174 |
+
= 2.7.5 =
|
175 |
+
|
176 |
+
Fix for a small number of PDFs rendering as smaller than expected on some high resolution screens.
|
177 |
+
|
178 |
= 2.7.3 =
|
179 |
|
180 |
**Please clear browser and any WordPress cache if you experience any problems following this upgrade.**
|