pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1781138 - in /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible: PDFTemplateBuilder.java PDFTemplateCreator.java PDVisibleSigBuilder.java PDVisibleSignDesigner.java
Date Tue, 31 Jan 2017 18:02:52 GMT
Author: tilman
Date: Tue Jan 31 18:02:52 2017
New Revision: 1781138

URL: http://svn.apache.org/viewvc?rev=1781138&view=rev
Log:
PDFBOX-3017: deprecate methods that use a byte array for AffineTransform, add methods that
use AffineTransform type

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateBuilder.java
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateBuilder.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateBuilder.java?rev=1781138&r1=1781137&r2=1781138&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateBuilder.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateBuilder.java
Tue Jan 31 18:02:52 2017
@@ -41,10 +41,18 @@ public interface PDFTemplateBuilder
     /**
      * In order to create Affine Transform, using parameters.
      * @param params
+     * @deprecated use {@link #createAffineTransform(java.awt.geom.AffineTransform) }
      */
+    @Deprecated
     void createAffineTransform(byte[] params);
 
     /**
+     * In order to create Affine Transform, using parameters.
+     * @param affineTransform
+     */
+    void createAffineTransform(AffineTransform affineTransform);
+
+    /**
      * Creates specified size page.
      * 
      * @param properties

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java?rev=1781138&r1=1781137&r2=1781138&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java
Tue Jan 31 18:02:52 2017
@@ -108,7 +108,7 @@ public class PDFTemplateCreator
         pdfBuilder.createAcroFormDictionary(acroForm, pdSignatureField);
         
         // create AffineTransform
-        pdfBuilder.createAffineTransform(properties.getAffineTransformParams());
+        pdfBuilder.createAffineTransform(properties.getTransform());
         AffineTransform transform = pdfStructure.getAffineTransform();
        
         // rectangle, formatter, image. /AcroForm/DR/XObject contains that form

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java?rev=1781138&r1=1781137&r2=1781138&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java
Tue Jan 31 18:02:52 2017
@@ -161,6 +161,7 @@ public class PDVisibleSigBuilder impleme
     }
 
     @Override
+    @Deprecated
     public void createAffineTransform(byte[] params)
     {
         AffineTransform transform = new AffineTransform(params[0], params[1], params[2],
@@ -169,6 +170,13 @@ public class PDVisibleSigBuilder impleme
         LOG.info("Matrix has been added");
     }
 
+    @Override
+    public void createAffineTransform(AffineTransform affineTransform)
+    {
+        pdfStructure.setAffineTransform(affineTransform);
+        LOG.info("Matrix has been added");
+    }
+
     @Override
     public void createProcSetArray()
     {

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java?rev=1781138&r1=1781137&r2=1781138&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java
Tue Jan 31 18:02:52 2017
@@ -16,6 +16,7 @@
  */
 package org.apache.pdfbox.pdmodel.interactive.digitalsignature.visible;
 
+import java.awt.geom.AffineTransform;
 import java.awt.image.BufferedImage;
 
 import java.io.BufferedInputStream;
@@ -48,7 +49,7 @@ public class PDVisibleSignDesigner
     private BufferedImage image;
     private String signatureFieldName = "sig";
     private byte[] formatterRectangleParams = { 0, 0, 100, 50 };
-    private byte[] affineTransformParams = { 1, 0, 0, 1, 0, 0 };
+    private AffineTransform affineTransform = new AffineTransform();
     private float imageSizeInPercents;
 
     /**
@@ -396,27 +397,60 @@ public class PDVisibleSignDesigner
     }
 
     /**
-     * 
      * @return Affine Transform parameters for PDF Matrix
+     * 
+     * @deprecated use {@link #getTransform() }.
      */
+    @Deprecated
     public byte[] getAffineTransformParams()
     {
-        return affineTransformParams;
+        return new byte[] 
+        {
+            (byte) affineTransform.getScaleX(), 
+            (byte) affineTransform.getShearY(), 
+            (byte) affineTransform.getShearX(), 
+            (byte) affineTransform.getScaleY(), 
+            (byte) affineTransform.getTranslateX(), 
+            (byte) affineTransform.getTranslateY()
+        };
+    }
+
+    /**
+     * @return Affine Transform parameters for PDF Matrix
+     */
+    public AffineTransform getTransform()
+    {
+        return affineTransform;
     }
 
     /**
      * 
      * @param affineTransformParams
      * @return Visible Signature Configuration Object
+     * @deprecated use {@link #transform}.
      */
+    @Deprecated
     public PDVisibleSignDesigner affineTransformParams(byte[] affineTransformParams)
     {
-        this.affineTransformParams = affineTransformParams;
+        affineTransform = new AffineTransform(affineTransformParams[0], affineTransformParams[1],
+                affineTransformParams[2], affineTransformParams[3],
+                affineTransformParams[4], affineTransformParams[5]);
         return this;
     }
 
     /**
      * 
+     * @param affineTransform
+     * @return Visible Signature Configuration Object
+     */
+    public PDVisibleSignDesigner transform(AffineTransform affineTransform)
+    {
+        this.affineTransform = new AffineTransform(affineTransform);
+        return this;
+    }
+    
+    /**
+     * 
      * @return formatter PDRectanle parameters
      */
     public byte[] getFormatterRectangleParams()



Mime
View raw message