aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2015-02-25 12:51:08 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2015-02-25 12:51:08 +0100
commitdf68bda01aee151df006900accd418ad06b303d7 (patch)
treed6012afa70dfede9cf0119061a3fb5f079d6c02c /pdf-as-web/src/main
parent23a283834becf8323489231ed5c48725f9716bb6 (diff)
downloadpdf-as-4-df68bda01aee151df006900accd418ad06b303d7.tar.gz
pdf-as-4-df68bda01aee151df006900accd418ad06b303d7.tar.bz2
pdf-as-4-df68bda01aee151df006900accd418ad06b303d7.zip
PDF-AS Web QR Code content integration
Diffstat (limited to 'pdf-as-web/src/main')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java54
1 files changed, 53 insertions, 1 deletions
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
index 1869dbb5..2e337f04 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
@@ -547,8 +547,36 @@ public class PdfAsHelper {
signParameter.setPlainSigner(signer);
+ String profile = params.getProfile();
+
+ //PdfAsHelper.getQRCodeContent(request);
+ // Get QR Code Content form param
+ String qrCodeContent = params.getQRCodeContent();
+
+ if(qrCodeContent != null) {
+ if(profile == null) {
+ // get default Profile
+ profile = config.getValue("sig_obj.type.default");
+ }
+
+ if(profile == null) {
+ logger.warn("Failed to determine default profile! Using hard coded!");
+ profile = "SIGNATURBLOCK_SMALL_DE";
+ }
+
+ ByteArrayOutputStream qrbaos = new ByteArrayOutputStream();
+ try {
+ String key = "sig_obj." + profile + ".value.SIG_LABEL";
+ QRCodeGenerator.generateQRCode(qrCodeContent, qrbaos, 200);
+ String value = Base64.encodeBase64String(qrbaos.toByteArray());
+ config.setValue(key, value);
+ } finally {
+ IOUtils.closeQuietly(qrbaos);
+ }
+ }
+
// set Signature Profile (null use default ...)
- signParameter.setSignatureProfileId(params.getProfile());
+ signParameter.setSignatureProfileId(profile);
// set Signature Position
signParameter.setSignaturePosition(params.getPosition());
@@ -625,6 +653,30 @@ public class PdfAsHelper {
session.setAttribute(PDF_SIGNER, signer);
session.setAttribute(PDF_SL_INTERACTIVE, connector);
+ String qrCodeContent = PdfAsHelper.getQRCodeContent(request);
+
+ if(qrCodeContent != null) {
+ if(profile == null) {
+ // get default Profile
+ profile = config.getValue("sig_obj.type.default");
+ }
+
+ if(profile == null) {
+ logger.warn("Failed to determine default profile! Using hard coded!");
+ profile = "SIGNATURBLOCK_SMALL_DE";
+ }
+
+ ByteArrayOutputStream qrbaos = new ByteArrayOutputStream();
+ try {
+ String key = "sig_obj." + profile + ".value.SIG_LABEL";
+ QRCodeGenerator.generateQRCode(qrCodeContent, qrbaos, 200);
+ String value = Base64.encodeBase64String(qrbaos.toByteArray());
+ config.setValue(key, value);
+ } finally {
+ IOUtils.closeQuietly(qrbaos);
+ }
+ }
+
// set Signature Profile (null use default ...)
signParameter.setSignatureProfileId(profile);