aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-pdfbox-2/src/main
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2016-11-04 11:00:41 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2016-11-04 11:00:41 +0100
commitd2c8450b2e570c2ef6624b57ef6e048c88e99d37 (patch)
tree615679093ef73621b69937eba2e5cc84dc5a5136 /pdf-as-pdfbox-2/src/main
parent6b81ceefb012a351fec6fd4cb0cee38d7b254f16 (diff)
downloadpdf-as-4-d2c8450b2e570c2ef6624b57ef6e048c88e99d37.tar.gz
pdf-as-4-d2c8450b2e570c2ef6624b57ef6e048c88e99d37.tar.bz2
pdf-as-4-d2c8450b2e570c2ef6624b57ef6e048c88e99d37.zip
use pdfbox saveIncremental method
Diffstat (limited to 'pdf-as-pdfbox-2/src/main')
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java63
1 files changed, 1 insertions, 62 deletions
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
index da8654ce..37c8899d 100644
--- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
+++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
@@ -571,55 +571,11 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants {
}
}
- if (requestedSignature.isVisual()) {
-
- // if(requestedSignature.getSignaturePosition().)
- /*
- * PDAcroForm acroForm =
- * doc.getDocumentCatalog().getAcroForm(); if (acroForm !=
- * null) {
- *
- * @SuppressWarnings("unchecked") List<PDField> fields =
- * acroForm.getFields(); PDSignatureField signatureField =
- * null;
- *
- * if (fields != null) { for (PDField pdField : fields) { if
- * (pdField instanceof PDSignatureField) { if
- * (((PDSignatureField) pdField).getSignature()
- * .getDictionary() .equals(signature.getDictionary())) {
- * signatureField = (PDSignatureField) pdField; } } } } else
- * { logger.warn(
- * "Failed to apply rotation! [Cannot find Field list in acroForm!]"
- * ); }
- *
- * if (signatureField != null) { if
- * (signatureField.getWidget() != null) { if
- * (signatureField.getWidget()
- * .getAppearanceCharacteristics() == null) {
- * PDAppearanceCharacteristicsDictionary dict = new
- * PDAppearanceCharacteristicsDictionary( new
- * COSDictionary()); signatureField.getWidget()
- * .setAppearanceCharacteristics(dict); }
- *
- * if (signatureField.getWidget()
- * .getAppearanceCharacteristics() != null) {
- * signatureField.getWidget()
- * .getAppearanceCharacteristics() .setRotation(90); } } }
- * else { logger.warn(
- * "Failed to apply rotation! [Cannot find signature Field!]"
- * ); } } else { logger.warn(
- * "Failed to apply rotation! [Cannot find acroForm!]" ); }
- */
- }
-
-
-
-
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
synchronized (doc) {
- this.saveIncremental(bos, doc, pdfObject.getOriginalDocument().getInputStream(), signer);
+ doc.saveIncremental(bos);
pdfObject.setSignedDocument(bos.toByteArray());
}
@@ -651,23 +607,6 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants {
}
}
- public void saveIncremental(OutputStream outStream, PDDocument doc, InputStream inStream, SignatureInterface signer) throws IOException{
- COSWriter writer = null;
- try
- {
- writer = new COSWriter(outStream, inStream);
- writer.write(doc, signer);
- writer.close();
- }
- finally
- {
- if (writer != null)
- {
- writer.close();
- }
- }
- }
-
@Override
public PDFObject buildPDFObject(OperationStatus operationStatus) {
return new PDFBOXObject(operationStatus);