diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2015-05-06 10:57:48 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2015-05-06 10:57:48 +0200 |
commit | ec4490769f0fc9c1562688b2393e97885f39a04b (patch) | |
tree | 93482819d294e2116e50967ca3367effa4f2bb17 | |
parent | 4f38f413efdb6b3e170bfd9433c74c10fddd4995 (diff) | |
download | pdf-as-4-ec4490769f0fc9c1562688b2393e97885f39a04b.tar.gz pdf-as-4-ec4490769f0fc9c1562688b2393e97885f39a04b.tar.bz2 pdf-as-4-ec4490769f0fc9c1562688b2393e97885f39a04b.zip |
potential fix for wrongly formated stream
-rw-r--r-- | pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java index fd9737b1..882830bc 100644 --- a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java +++ b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java @@ -23,12 +23,9 @@ ******************************************************************************/ package at.gv.egiz.pdfas.lib.impl.stamping.pdfbox; -import java.awt.Transparency; import java.awt.geom.AffineTransform; import java.awt.geom.Point2D; import java.awt.image.BufferedImage; -import java.io.ByteArrayInputStream; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -38,11 +35,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.imageio.ImageIO; - -import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Hex; -import org.apache.commons.io.IOUtils; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; @@ -322,7 +315,7 @@ public class PDFAsVisualSignatureBuilder extends PDVisibleSigBuilder implements String holderFormComment = "q " + m00 + " " + m10 + " " + m01 + " " + m11 + " " + m02 + " " + m12 + " cm /" + innerFormName - + " Do Q \n"; + + " Do Q"; logger.debug("Holder Form Stream: " + holderFormComment); @@ -337,9 +330,9 @@ public class PDFAsVisualSignatureBuilder extends PDVisibleSigBuilder implements // getStructure().getInnterFormStream().getInputStreamAsString()); appendRawCommands(getStructure().getHolderFormStream() - .createOutputStream(), holderFormComment); + .createOutputStream(), holderFormComment.trim().replace("\n", "").replace("\r", "")); appendRawCommands(getStructure().getInnterFormStream() - .createOutputStream(), innerFormComment); + .createOutputStream(), innerFormComment.trim().replace("\n", "").replace("\r", "")); // appendRawCommands(getStructure().getImageFormStream().createOutputStream(), // imgFormComment); logger.debug("Injected apereance stream to pdf"); |