From ec4490769f0fc9c1562688b2393e97885f39a04b Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Wed, 6 May 2015 10:57:48 +0200 Subject: potential fix for wrongly formated stream --- .../impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'pdf-as-pdfbox/src/main') 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"); -- cgit v1.2.3