diff options
Diffstat (limited to 'pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas')
-rw-r--r-- | pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java | 63 |
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); |