aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-web')
-rw-r--r--pdf-as-web/src/main/resources/template_error.html17
-rw-r--r--pdf-as-web/src/main/resources/template_provide.html13
-rw-r--r--pdf-as-web/src/main/webapp/assets/bootstrap/css/bootstrap-nav2/dist/bootstrap-nav-wizard.css1
-rw-r--r--pdf-as-web/src/main/webapp/assets/css/style.css168
-rw-r--r--pdf-as-web/src/main/webapp/assets/js/dragNdrop.js256
-rw-r--r--pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.css49
-rw-r--r--pdf-as-web/src/main/webapp/index.jsp2
7 files changed, 351 insertions, 155 deletions
diff --git a/pdf-as-web/src/main/resources/template_error.html b/pdf-as-web/src/main/resources/template_error.html
index 47ba9c56..21faa082 100644
--- a/pdf-as-web/src/main/resources/template_error.html
+++ b/pdf-as-web/src/main/resources/template_error.html
@@ -8,20 +8,11 @@ Error Page:
<p>##ERROR_MESSAGE##</p>
<p>##ERROR_STACK##</p>
<script type="text/javascript">
- try {
- var data = {
- pdfas: {
- error: true,
- msg: "##ERROR_MESSAGE##"
- }
- }
- parent.postMessage(data, '##PUBLICURL##');
- } catch(error) {
- if(window.console) {
- window.console.log("Sending message failed! to parent: " + parent, error);
- }
- }
+ console.log("sending error msg to parent: " + parent);
+ window.parent.respond("##PDFDATAURL##", false);
+
+
</script>
</body>
</html>
diff --git a/pdf-as-web/src/main/resources/template_provide.html b/pdf-as-web/src/main/resources/template_provide.html
index 28b51ed4..76287404 100644
--- a/pdf-as-web/src/main/resources/template_provide.html
+++ b/pdf-as-web/src/main/resources/template_provide.html
@@ -7,15 +7,12 @@
PDF ready @: <a href="##PDFDATAURL##">download here</a>
<script type="text/javascript">
- var data = {
- pdfas: {
- success: true,
- pdfUrl: "##PDFDATAURL##"
- }
- }
- console.log("sending msg to parent: " + parent);
- parent.postMessage(data, '*'); //'##PUBLICURL##');
+
+ console.log("sending success msg to parent: " + parent);
+ window.parent.respond("##PDFDATAURL##", true);
+
+
</script>
</body>
</html>
diff --git a/pdf-as-web/src/main/webapp/assets/bootstrap/css/bootstrap-nav2/dist/bootstrap-nav-wizard.css b/pdf-as-web/src/main/webapp/assets/bootstrap/css/bootstrap-nav2/dist/bootstrap-nav-wizard.css
index 607ae01f..fc6cd7fc 100644
--- a/pdf-as-web/src/main/webapp/assets/bootstrap/css/bootstrap-nav2/dist/bootstrap-nav-wizard.css
+++ b/pdf-as-web/src/main/webapp/assets/bootstrap/css/bootstrap-nav2/dist/bootstrap-nav-wizard.css
@@ -45,7 +45,6 @@ ul.nav-wizard li {
width: 1%; /* New*/
}
ul.nav-wizard li a {
- color: #468847;
padding: 0;
}
ul.nav-wizard li a:hover {
diff --git a/pdf-as-web/src/main/webapp/assets/css/style.css b/pdf-as-web/src/main/webapp/assets/css/style.css
index 974ea5e0..5eb1955d 100644
--- a/pdf-as-web/src/main/webapp/assets/css/style.css
+++ b/pdf-as-web/src/main/webapp/assets/css/style.css
@@ -4,9 +4,128 @@ html {
}
body {
- background-image: url("../img/bg.png");
+ /*background-image: url("../img/bg.png"); */
font-family: 'OpenSans', sans-serif;
-
+}
+
+/* Colors */
+body {
+ background-color: #9E9E9E !important;
+}
+
+.container {
+ background: #9E9E9E;
+ border: none !important;
+ box-shadow:none !important;
+}
+
+#PageTitle {
+ color: white;
+}
+
+.label-info {
+ background-color: #03A9F4 !important;
+ color: #212121 !important;
+}
+
+ul.nav-wizard li.active, ul.nav-wizard li.active a {
+ color: #212121 !important;
+ background: #03A9F4 !important;
+}
+
+ul.nav-wizard li.active:after {
+ border-left-color: #03A9F4 !important;
+}
+
+ul.nav-wizard {
+ border: none !important;
+}
+
+ul.nav-wizard li a {
+ color: #8BC34A;
+}
+
+.btn-primary {
+ color: #fff !important;
+ background-color: #0288D1 !important;
+ border-color: #0288D1 !important;
+}
+
+.btn-success {
+ color: #fff !important;
+ background-color: #8BC34A !important;
+ border-color: #8BC34A !important;
+}
+
+.has-success .form-control {
+ border-color: #8BC34A !important;
+}
+
+.has-success .form-control-feedback {
+ color: #8BC34A !important;
+}
+
+#noPdfMessage
+{
+ color: #D32F2F !important;
+}
+
+.has-error .form-control {
+ border-color: #D32F2F !important;
+}
+
+.has-error .form-control-feedback {
+ color: #D32F2F !important;
+}
+
+#ResultInfoText {
+ color: white;
+}
+
+#FormBox h5 {
+ color: white;
+}
+
+.ImageBox {
+ color: white;
+}
+
+/* Colors End */
+
+.ImageBox {
+ width: 100px;
+ height: 125px;
+ text-align:center;
+}
+
+.ImageBox:hover {
+ cursor:hand;
+ cursor:pointer;
+ border: 1px dashed;
+}
+
+#FormBox h5 {
+ text-align:center;
+}
+
+#ResultInfoText {
+ margin-left: 2em;
+ margin-right: 2em;
+ font-size: 16px;
+}
+
+#PageTitle {
+ font-weight: bold;
+ font-size: 150%;
+}
+
+.container {
+ border: 0.125em solid;
+ border-color: #66A3FF;
+ box-shadow: 0em 0em 1em #333333;
+ margin-bottom: 0em;
+ margin-left: 5em;
+ margin-right: 5em;
}
footer {
@@ -252,12 +371,6 @@ ul.nav-wizard li a {
margin-left: 0.5em;
}
-#PageTitle {
- color: grey;
- font-weight: bold;
- font-size: 150%;
-}
-
iframe {
border: none;
/* min-width:5em; */
@@ -310,13 +423,6 @@ body.wait, body.wait *{
margin-top: 15em;;
}
-#ResultInfoText {
- margin-left: 2em;
- margin-right: 2em;
- font-size: 16px;
- color: #286090;
-}
-
#DownloadResultButton {
margin-left: auto;
margin-right: auto;
@@ -324,18 +430,6 @@ body.wait, body.wait *{
display: block;
}
-.ImageBox {
- width: 100px;
- height: 125px;
- text-align:center;
-}
-
-.ImageBox:hover {
- cursor:hand;
- cursor:pointer;
- border: 1px dashed;
-}
-
.BKUImage {
margin-top: 12px;
}
@@ -435,10 +529,6 @@ body.wait, body.wait *{
}
}
-#FormBox h5 {
- text-align:center;
-}
-
#FormBox {
width: 20em;
}
@@ -482,17 +572,6 @@ body.wait, body.wait *{
align-items: center;
}
-.container {
- border: 0.125em solid;
- border-color: #66A3FF;
- background: #E8F4FF;
- box-shadow: 0em 0em 1em #333333;
- margin-bottom: 0em;
- margin-left: 5em;
- margin-right: 5em;
-
-}
-
.container h3 {
font-style: bold;
color: #204a87;
@@ -547,11 +626,6 @@ body.wait, body.wait *{
z-index: 3000;
}
-#noPdfMessage
-{
- color: red;
-}
-
#ContinueButtonBox {
}
diff --git a/pdf-as-web/src/main/webapp/assets/js/dragNdrop.js b/pdf-as-web/src/main/webapp/assets/js/dragNdrop.js
index 182f282a..cfca7314 100644
--- a/pdf-as-web/src/main/webapp/assets/js/dragNdrop.js
+++ b/pdf-as-web/src/main/webapp/assets/js/dragNdrop.js
@@ -360,6 +360,21 @@ function previewFile() {
createIframe();
}
+// from "Einfach Signieren"
+function addDataToForm(data, form) {
+ var ret = [];
+ for (var d in data) {
+ if (typeof data[d] != "undefined") {
+ var input = document.createElement('input');
+ input.type = 'hidden';
+ input.name = d;
+ input.value = data[d];
+ form.appendChild(input);
+ }
+ }
+}
+
+
//
//Calls the sign servlet with the provided file and the provided connector and locale
//
@@ -368,32 +383,154 @@ function sign(file, connector, locale) {
alert("No file selected");
return
}
- var fd = new FormData();
+ /*var fd = new FormData();
fd.append("source", "internal");
fd.append("pdf-file", file);
fd.append("connector", connector);
- fd.append("locale", locale);
-
- ifr = document.getElementById('iFrame').contentWindow;
- if(ifr.isSignaturePlaced()) { //Signature has been manually placed
-
- console.log("signature manually placed: x: y:" + ifr.global_status.getSignature().posx + ", " + ifr.global_status.getSignature().posy)
- fd.append("sig-pos-x", ifr.global_status.getSignature().posx);
- fd.append("sig-pos-y", ifr.global_status.getSignature().posy);
- fd.append("sig-pos-p", ifr.global_status.getSignature().page);
- }
- else if(place_on_new_page)
- {
- console.log("signature will be placed on a new page");
- fd.append("sig-pos-p", "new");
- place_on_new_page = false;
- }
- else
+ fd.append("locale", locale); */
+
+ /*var parameters = {
+ source: "internal",
+ pdf-file: file,
+ connector: connector,
+ locale: local,
+ sig-pos-x: null,
+ sig-pos-y: null,
+ sig-pos-p: null
+ }; */
+
+ var form = document.createElement('form');
+ form.method = "POST";
+ form.action = "Sign";
+ form.target = "mobileSignOnFrame";
+ form.enctype = "multipart/form-data";
+
+ var input = document.createElement('input');
+ input.type = 'hidden';
+ input.name = "source";
+ input.value = "internal";
+ form.appendChild(input);
+
+ // used beneath
+ function uint8ToString(buf) {
+ var i, length, out = '';
+ for (i = 0, length = buf.length; i < length; i += 1) {
+ out += String.fromCharCode(buf[i]);
+ }
+ return out;
+ }
+
+ // starting the asynchronous things
+
+ begin_convert(file);
+
+ // convert file to b64 string
+
+ function begin_convert(file)
{
- console.log("signature will be placed on bottom");
+ // Read the local file into a Uint8Array.
+ var fileReader = new FileReader();
+
+ fileReader.onload = function webViewerChangeFileReaderOnload(evt)
+ {
+ var buffer = evt.target.result;
+ var uint8Array = new Uint8Array(buffer);
+
+
+ var b64encoded = btoa(String.fromCharCode.apply(null, uint8Array));
+
+ var result = uint8ToString(b64encoded);
+
+
+ continueFormCreation(result);
+
+
+ };
+
+ console.log("converting to b64..");
+ fileReader.readAsArrayBuffer(file);
+
}
+
+
+ function continueFormCreation(result)
+ {
+
+ input = document.createElement('input');
+ input.type = 'hidden';
+ input.name = "pdf-file-b64";
+ input.value = result; // former: file
+ form.appendChild(input);
+
+ input = document.createElement('input');
+ input.type = 'hidden';
+ input.name = "connector";
+ input.value = connector;
+ form.appendChild(input);
+
+ input = document.createElement('input');
+ input.type = 'hidden';
+ input.name = "locale";
+ input.value = locale;
+ form.appendChild(input);
+
+ ifr = document.getElementById('iFrame').contentWindow;
+ if(ifr.isSignaturePlaced()) { //Signature has been manually placed
+
+ console.log("signature manually placed: x: y:" + ifr.global_status.getSignature().posx + ", " + ifr.global_status.getSignature().posy)
+ /*fd.append("sig-pos-x", ifr.global_status.getSignature().posx);
+ fd.append("sig-pos-y", ifr.global_status.getSignature().posy);
+ fd.append("sig-pos-p", ifr.global_status.getSignature().page); */
+
+ /*parameters.sig-pos-x = ifr.global_status.getSignature().posx;
+ parameters.sig-pos-y = ifr.global_status.getSignature().posy;
+ parameters.sig-pos-p = ifr.global_status.getSignature().page; */
+
+ input = document.createElement('input');
+ input.type = 'hidden';
+ input.name = "sig-pos-x";
+ input.value = ifr.global_status.getSignature().posx;
+ form.appendChild(input);
+
+ input = document.createElement('input');
+ input.type = 'hidden';
+ input.name = "sig-pos-y";
+ input.value = ifr.global_status.getSignature().posy;
+ form.appendChild(input);
+
+ input = document.createElement('input');
+ input.type = 'hidden';
+ input.name = "sig-pos-p";
+ input.value = ifr.global_status.getSignature().page;
+ form.appendChild(input);
+ }
+ else if(place_on_new_page)
+ {
+ console.log("signature will be placed on a new page");
+ /*fd.append("sig-pos-p", "new"); */
+ /* parameters.sig-pos-p = "new"; */
+
+ input = document.createElement('input');
+ input.type = 'hidden';
+ input.name = "sig-pos-p";
+ input.value = "new";
+ form.appendChild(input);
+
+ place_on_new_page = false;
+ }
+ else
+ {
+ console.log("signature will be placed on bottom");
+ }
+
+ document.body.appendChild(form);
+ $("#methodContainer").hide();
+ $("#mobileSignOnFrame").show();
+ form.submit();
+
+ }
- $.ajax({
+/* $.ajax({
url: "Sign",
data: fd,
processData: false,
@@ -434,7 +571,7 @@ function sign(file, connector, locale) {
var download_name = file.name.insertAt(insertIndex, "_signed");
$("#DownloadResultButton").attr("download", download_name);
- $("#FinishStepButton").click(); */
+ $("#FinishStepButton").click(); */ /*
$("#methodContainer").hide();
$("#mobileSignOnFrame").show();
$("#mobileSignOnFrame").contents().find('html').empty();
@@ -469,9 +606,9 @@ function sign(file, connector, locale) {
$("#closelink").bind("click", function(evt) {
$("#fade").remove();
$("#popup").remove();
- });*/
+ });*/ /*
}
- });
+ }); */
}
//
@@ -516,57 +653,34 @@ $(document).ready(function() {
}
registerEventListeners();
-
- // handle server response after signing with mobile / card
-
- function success(arg) { // called when user successfully signed with mobile / card
- //document.getElementById("demo").innerHTML = arg;
- console.log("recieved successful response from server, arg: " + arg);
-
- $("#DownloadResultButton").attr("href", arg);
-
- var insertIndex = file.name.indexOf(".pdf");
-
- var download_name = file.name.insertAt(insertIndex, "_signed");
- $("#DownloadResultButton").attr("download", download_name);
- $("#methodContainer").show();
- $("#mobileSignOnFrame").hide();
- $("#FinishStepButton").click();
-
-
-
- };
- function error(arg) { // called when an error appears while user was signing, e.g: abort
- //document.getElementById("demo").innerHTML = arg;
- console.log("recieved error response from server, arg: " + arg);
-
- // do something
- };
+});
- function handle(event) { // handles the incoming server response
- if (event.data.pdfas) {
- if (event.data.pdfas.success) {
- success(event.data.pdfas.pdfUrl);
- } else if (event.data.pdfas.error) {
- error(event.data.pdfas.msg);
- }
- }
+function respond(arg, success) { // called when user successfully signed with mobile / card
+ //document.getElementById("demo").innerHTML = arg;
+ console.log("recieved response after server contact, arg: " + arg + ", success: " + success);
+
+
+ if(!success)
+ {
+ window.alert("Server Response Error, please try again");
+ $("#SignStepButton").click();
+ return;
}
-
- // Creates Listener for server fired event when user finished signing the document on other domain
- // Create IE + others compatible event handler
- var eventMethod = window.addEventListener
- ? "addEventListener"
- : "attachEvent";
- var eventer = window[eventMethod];
- var messageEvent = eventMethod == "attachEvent"
- ? "onmessage"
- : "message";
-
- // Listen to message from child window
- eventer(messageEvent, handle, false);
-});
+
+ $("#DownloadResultButton").attr("href", arg);
+
+ var insertIndex = file.name.indexOf(".pdf");
+
+ var download_name = file.name.insertAt(insertIndex, "_signed");
+ $("#DownloadResultButton").attr("download", download_name);
+ $("#methodContainer").show();
+ $("#mobileSignOnFrame").hide();
+ $("#FinishStepButton").click();
+
+
+
+};
function toggleLanguage()
diff --git a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.css b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.css
index cae4eeb2..effc7b7d 100644
--- a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.css
+++ b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.css
@@ -12,6 +12,40 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+ /* Colors */
+
+ #mainContainer {
+
+ background-color: #9E9E9E;
+ }
+
+ .btn-primary {
+ color: #fff !important;
+ background-color: #0288D1 !important;
+ border-color: #0288D1 !important;
+}
+
+.btn-success {
+ color: #fff !important;
+ background-color: #8BC34A !important;
+ border-color: #8BC34A !important;
+}
+
+ /* Colors End */
+
+ #mainContainer {
+ position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ min-width: 10em;
+ -webkit-transition-duration: 200ms;
+ -webkit-transition-timing-function: ease;
+ transition-duration: 200ms;
+ transition-timing-function: ease;
+ }
.textLayer {
position: absolute;
@@ -350,20 +384,7 @@ html[dir='rtl'] #outerContainer.sidebarOpen > #sidebarContainer {
right: 0px;
}
-#mainContainer {
- position: absolute;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- min-width: 10em;
- -webkit-transition-duration: 200ms;
- -webkit-transition-timing-function: ease;
- transition-duration: 200ms;
- transition-timing-function: ease;
-
- background-color: #E8F4FF;
-}
+
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
diff --git a/pdf-as-web/src/main/webapp/index.jsp b/pdf-as-web/src/main/webapp/index.jsp
index dc16f8fd..45ea4fed 100644
--- a/pdf-as-web/src/main/webapp/index.jsp
+++ b/pdf-as-web/src/main/webapp/index.jsp
@@ -139,7 +139,7 @@
}
%>
</div>
- <iframe id='mobileSignOnFrame' style="display:none;"></iframe>
+ <iframe id='mobileSignOnFrame' style="display:none;" src="http://129.27.142.196:8080/"></iframe>
</div>
</div>
<div id="DownloadContainer" style="display: none;">