Merge pull request #5844 from Snuffleupagus/noPageBorder
Add a |PDFViewer| option to remove the border shadow around pages (issue 5559)
This commit is contained in:
commit
c5eb34ed09
@ -31,6 +31,11 @@
|
|||||||
background-color: white;
|
background-color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pdfViewer.removePageBorders .page {
|
||||||
|
margin: 0px auto 10px auto;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
.pdfViewer .page canvas {
|
.pdfViewer .page canvas {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -44,6 +44,8 @@ var DEFAULT_CACHE_SIZE = 10;
|
|||||||
* @property {IPDFLinkService} linkService - The navigation/linking service.
|
* @property {IPDFLinkService} linkService - The navigation/linking service.
|
||||||
* @property {PDFRenderingQueue} renderingQueue - (optional) The rendering
|
* @property {PDFRenderingQueue} renderingQueue - (optional) The rendering
|
||||||
* queue object.
|
* queue object.
|
||||||
|
* @property {boolean} removePageBorders - (optional) Removes the border shadow
|
||||||
|
* around the pages. The default is false.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,6 +82,7 @@ var PDFViewer = (function pdfViewer() {
|
|||||||
this.container = options.container;
|
this.container = options.container;
|
||||||
this.viewer = options.viewer || options.container.firstElementChild;
|
this.viewer = options.viewer || options.container.firstElementChild;
|
||||||
this.linkService = options.linkService || new SimpleLinkService(this);
|
this.linkService = options.linkService || new SimpleLinkService(this);
|
||||||
|
this.removePageBorders = options.removePageBorders || false;
|
||||||
|
|
||||||
this.defaultRenderingQueue = !options.renderingQueue;
|
this.defaultRenderingQueue = !options.renderingQueue;
|
||||||
if (this.defaultRenderingQueue) {
|
if (this.defaultRenderingQueue) {
|
||||||
@ -94,6 +97,10 @@ var PDFViewer = (function pdfViewer() {
|
|||||||
this.updateInProgress = false;
|
this.updateInProgress = false;
|
||||||
this.presentationModeState = PresentationModeState.UNKNOWN;
|
this.presentationModeState = PresentationModeState.UNKNOWN;
|
||||||
this._resetView();
|
this._resetView();
|
||||||
|
|
||||||
|
if (this.removePageBorders) {
|
||||||
|
this.viewer.classList.add('removePageBorders');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PDFViewer.prototype = /** @lends PDFViewer.prototype */{
|
PDFViewer.prototype = /** @lends PDFViewer.prototype */{
|
||||||
@ -397,8 +404,10 @@ var PDFViewer = (function pdfViewer() {
|
|||||||
}
|
}
|
||||||
var inPresentationMode =
|
var inPresentationMode =
|
||||||
this.presentationModeState === PresentationModeState.FULLSCREEN;
|
this.presentationModeState === PresentationModeState.FULLSCREEN;
|
||||||
var hPadding = inPresentationMode ? 0 : SCROLLBAR_PADDING;
|
var hPadding = (inPresentationMode || this.removePageBorders) ?
|
||||||
var vPadding = inPresentationMode ? 0 : VERTICAL_PADDING;
|
0 : SCROLLBAR_PADDING;
|
||||||
|
var vPadding = (inPresentationMode || this.removePageBorders) ?
|
||||||
|
0 : VERTICAL_PADDING;
|
||||||
var pageWidthScale = (this.container.clientWidth - hPadding) /
|
var pageWidthScale = (this.container.clientWidth - hPadding) /
|
||||||
currentPage.width * currentPage.scale;
|
currentPage.width * currentPage.scale;
|
||||||
var pageHeightScale = (this.container.clientHeight - vPadding) /
|
var pageHeightScale = (this.container.clientHeight - vPadding) /
|
||||||
@ -501,9 +510,12 @@ var PDFViewer = (function pdfViewer() {
|
|||||||
width = dest[4] - x;
|
width = dest[4] - x;
|
||||||
height = dest[5] - y;
|
height = dest[5] - y;
|
||||||
var viewerContainer = this.container;
|
var viewerContainer = this.container;
|
||||||
widthScale = (viewerContainer.clientWidth - SCROLLBAR_PADDING) /
|
var hPadding = this.removePageBorders ? 0 : SCROLLBAR_PADDING;
|
||||||
|
var vPadding = this.removePageBorders ? 0 : VERTICAL_PADDING;
|
||||||
|
|
||||||
|
widthScale = (viewerContainer.clientWidth - hPadding) /
|
||||||
width / CSS_UNITS;
|
width / CSS_UNITS;
|
||||||
heightScale = (viewerContainer.clientHeight - SCROLLBAR_PADDING) /
|
heightScale = (viewerContainer.clientHeight - vPadding) /
|
||||||
height / CSS_UNITS;
|
height / CSS_UNITS;
|
||||||
scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));
|
scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user