Permalink
Browse files

Integration scripts

  • Loading branch information...
ajkauffmann committed Jan 19, 2019
1 parent 04013e6 commit c634e287156b00c8cbaaca569429e4476c4efdab
@@ -1,13 +1,12 @@
var __ViewerFrame;
var __ViewerDomain = "https://pdfviewer.kauffmann.nl";
var __ViewerPath = "/web/viewer.html";
var __ViewerDomain = "http://pdfviewer.kauffmann.nl";

function InitializeControl(controlId) {
window.addEventListener("message", onMessage, false);
var controlAddIn = document.getElementById(controlId);
controlAddIn.innerHTML = '<iframe id="viewer" style="border-style: none; margin: 0px; padding: 0px; height: 100%; width: 100%" allowFullScreen></iframe>'
__ViewerFrame = document.getElementById('viewer');
__ViewerFrame.src = __ViewerDomain + __ViewerPath;
__ViewerFrame.src = __ViewerDomain + "/web/viewer.html?file=";
}

function onMessage(event) {
@@ -0,0 +1,40 @@
window.addEventListener("message", function(event) {
var data = event.data;

if (typeof(window[data.func]) == "function") {
window[data.func].call(null, data.message);
}
});

window.addEventListener("webviewerloaded", function(event) {
window.parent.postMessage({
'func': 'pdfViewerReady',
'message': ''
}, "*");
});

function BCLoadDocument(data) {
var content = data.content;
if (data.type = 'base64') {
content = base64ToUint8Array(content);
};
PDFViewerApplication.open(content).then(function() {
raiseDocumentOpen();
});
}

function base64ToUint8Array(base64) {
var raw = atob(base64);
var uint8Array = new Uint8Array(raw.length);
for(var i = 0; i < raw.length; i++) {
uint8Array[i] = raw.charCodeAt(i);
}
return uint8Array;
}

function raiseDocumentOpen() {
window.parent.postMessage({
'func': 'onDocumentOpen',
'message': ''
}, "*");
}
@@ -411,7 +411,7 @@ html {
body {
height: 100%;
width: 100%;
background-color: #404040;
background-color: #f6f7f8;
background-image: url(images/texture.png);
}

@@ -618,6 +618,7 @@ html[dir='rtl'] #sidebarContent {
bottom: 0;
left: 0;
outline: none;
border: 1px solid #d3d6da;
}
#viewerContainer:not(.pdfPresentationMode) {
transition-duration: 200ms;
@@ -661,9 +662,9 @@ html[dir='rtl'] #outerContainer.sidebarOpen #viewerContainer:not(.pdfPresentatio
#toolbarSidebar {
width: 100%;
height: 32px;
background-color: #424242; /* fallback */
background-image: url(images/texture.png),
linear-gradient(hsla(0,0%,30%,.99), hsla(0,0%,25%,.95));
background-color: #505C6D;
/*background-image: url(images/texture.png),
linear-gradient(hsla(0,0%,30%,.99), hsla(0,0%,25%,.95));*/
}
html[dir='ltr'] #toolbarSidebar {
box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.25),
@@ -696,9 +697,9 @@ html[dir='rtl'] #sidebarResizer {
#toolbarContainer, .findbar, .secondaryToolbar {
position: relative;
height: 32px;
background-color: #474747; /* fallback */
background-image: url(images/texture.png),
linear-gradient(hsla(0,0%,32%,.99), hsla(0,0%,27%,.95));
background-color: #505C6D;
/*background-image: url(images/texture.png),
linear-gradient(hsla(0,0%,32%,.99), hsla(0,0%,27%,.95));*/
}
html[dir='ltr'] #toolbarContainer, .findbar, .secondaryToolbar {
box-shadow: inset 0 1px 1px hsla(0,0%,0%,.15),
@@ -721,7 +722,7 @@ html[dir='rtl'] #toolbarContainer, .findbar, .secondaryToolbar {
position: relative;
width: 100%;
height: 4px;
background-color: #333;
background-color: #505C6D;
border-bottom: 1px solid #333;
}

@@ -37,6 +37,7 @@
<script src="../build/pdf.js"></script>


<script src="bcintegration.js"></script>
<script src="viewer.js"></script>

</head>

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit c634e28

Please sign in to comment.