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