diff options
Diffstat (limited to 'pdf-as-web/src/main/java/at')
3 files changed, 31 insertions, 2 deletions
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java index 925df3a..dd0e876 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java @@ -18,6 +18,8 @@ import org.apache.commons.logging.LogFactory; import at.gv.egiz.pdfas.api.PdfAs;
import at.gv.egiz.pdfas.api.commons.Constants;
+import at.gv.egiz.pdfas.api.commons.DynamicSignatureLifetimeEnum;
+import at.gv.egiz.pdfas.api.commons.DynamicSignatureProfile;
import at.gv.egiz.pdfas.api.exceptions.PdfAsException;
import at.gv.egiz.pdfas.api.internal.PdfAsInternal;
import at.gv.egiz.pdfas.api.io.DataSink;
@@ -77,6 +79,20 @@ public class SignServletHelper DataSink sink = new ByteArrayDataSink();
signParameters.setOutput(sink);
+ /* // dynamically switch to pdf/a
+ if (si.pdfa) {
+ DynamicSignatureProfile dsp = pdfAs.createDynamicSignatureProfile(
+ signParameters.getSignatureProfileId(),
+ DynamicSignatureLifetimeEnum.AUTO
+ );
+ dsp.setPropertyRaw("key.SIG_PDFA1B_VALID", "true");
+ dsp.setPropertyRaw("table.main.Style.font", "TTF:DejaVuSansCondensed.ttf,8");
+ dsp.setPropertyRaw("table.main.Style.valuefont", "TTF:DejaVuSansMono.ttf,8");
+ dsp.apply();
+ signParameters.setSignatureProfileId(dsp.getName());
+ }
+ */
+
SignatureDetailInformation signatureDetail = pdfAs.prepareSign(signParameters);
si.sdi = signatureDetail;
si.signParameters = signParameters;
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java index 45f7e8f..620a738 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java @@ -213,6 +213,7 @@ public class SignServlet extends HttpServlet si.type = ud.sig_type;
si.filename = formatFileName(ud.file_name);
si.download_inline = ud.download_inline;
+ si.pdfa = ud.pdfa;
// added tzefferer:
si.exappinf = exappinf;
@@ -397,6 +398,9 @@ public class SignServlet extends HttpServlet {
preview = true;
}
+
+ boolean pdfaEnabled = pdfa != null && "true".equalsIgnoreCase(pdfa.getString());
+
boolean download_inline = true;
if (download_fi.getString("UTF-8").equals(FormFields.VALUE_DOWNLOAD_ATTACHMENT)) //$NON-NLS-1$
@@ -438,7 +442,6 @@ public class SignServlet extends HttpServlet } else {
log.debug("Processing free text.");
try {
- boolean pdfaEnabled = pdfa != null && "true".equalsIgnoreCase(pdfa.getString());
byte[] freeTextPDF = IText.createPDF(freeText.getString("UTF-8"), pdfaEnabled);
pdfDataSource = new ByteArrayPdfDataSource(freeTextPDF);
@@ -455,6 +458,7 @@ public class SignServlet extends HttpServlet UploadedData ud = new UploadedData();
ud.preview = preview;
+ ud.pdfa = pdfaEnabled;
ud.download_inline = download_inline;
ud.sig_type = sig_type;
ud.sig_app = sig_app;
@@ -575,6 +579,8 @@ public class SignServlet extends HttpServlet {
protected boolean preview = false;
+ protected boolean pdfa = false;
+
protected boolean download_inline = false;
protected String sig_type = null;
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/session/SignSessionInformation.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/session/SignSessionInformation.java index 90378d9..0b6a4d3 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/session/SignSessionInformation.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/session/SignSessionInformation.java @@ -78,7 +78,7 @@ public class SignSessionInformation implements HttpSessionBindingListener, Seria * @author: Thomas Zefferer
*/
public ExternAppInformation exappinf;
-
+
/**
* Information about the signature position
*
@@ -87,6 +87,13 @@ public class SignSessionInformation implements HttpSessionBindingListener, Seria public SignaturePositioning pos;
/**
+ * <code>true</code> if pdf/a is enabled
+ *
+ * @author tknall
+ */
+ public boolean pdfa;
+
+ /**
* The SignatureDetailInformation.
*/
public SignatureDetailInformation sdi = null;
|