You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2017/11/14 18:42:45 UTC

svn commit: r1815245 - in /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible: PDFTemplateBuilder.java PDVisibleSigBuilder.java

Author: tilman
Date: Tue Nov 14 18:42:45 2017
New Revision: 1815245

URL: http://svn.apache.org/viewvc?rev=1815245&view=rev
Log:
PDFBOX-4011: put bbox in correct order and allow flexibility, deprecate current byte array method and introduce int array method

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/PDVisibleSigBuilder.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=1815245&r1=1815244&r2=1815245&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 Nov 14 18:42:45 2017
@@ -130,12 +130,27 @@ public interface PDFTemplateBuilder
     void createSignatureImage(PDDocument template, BufferedImage image) throws IOException;
 
     /**
-     * 
+     * An array of four numbers in the form coordinate system, giving the coordinates of the left,
+     * bottom, right, and top edges, respectively, of the form XObject’s bounding box. These
+     * boundaries shall be used to clip the form XObject and to determine its size for caching.
+     *
      * @param params
+     * 
+     * @deprecated use {@link #createFormatterRectangle(int[]) createFormatterRectangle(int[])}
      */
+    @Deprecated
     void createFormatterRectangle(byte[] params);
 
     /**
+     * An array of four numbers in the form coordinate system, giving the coordinates of the left,
+     * bottom, right, and top edges, respectively, of the form XObject’s bounding box. These
+     * boundaries shall be used to clip the form XObject and to determine its size for caching.
+     *
+     * @param params
+     */
+    void createFormatterRectangle(int[] params);
+
+    /**
      * 
      * @param template
      */

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=1815245&r1=1815244&r2=1815245&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 Nov 14 18:42:45 2017
@@ -202,14 +202,33 @@ public class PDVisibleSigBuilder impleme
         LOG.info("Visible Signature Image has been created");
     }
 
+    /**
+     * {@inheritDoc }
+     * 
+     * @deprecated use {@link #createFormatterRectangle(int[]) createFormatterRectangle(int[])}
+     */
     @Override
+    @Deprecated
     public void createFormatterRectangle(byte[] params)
     {
         PDRectangle formatterRectangle = new PDRectangle();
-        formatterRectangle.setUpperRightX(params[0]);
-        formatterRectangle.setUpperRightY(params[1]);
-        formatterRectangle.setLowerLeftX(params[2]);
-        formatterRectangle.setLowerLeftY(params[3]);
+        formatterRectangle.setLowerLeftX(Math.min(params[0],params[2]));
+        formatterRectangle.setLowerLeftY(Math.min(params[1],params[3]));
+        formatterRectangle.setUpperRightX(Math.max(params[0],params[2]));
+        formatterRectangle.setUpperRightY(Math.max(params[1],params[3]));
+
+        pdfStructure.setFormatterRectangle(formatterRectangle);
+        LOG.info("Formatter rectangle has been created");
+    }
+
+    @Override
+    public void createFormatterRectangle(int[] params)
+    {
+        PDRectangle formatterRectangle = new PDRectangle();
+        formatterRectangle.setLowerLeftX(Math.min(params[0],params[2]));
+        formatterRectangle.setLowerLeftY(Math.min(params[1],params[3]));
+        formatterRectangle.setUpperRightX(Math.max(params[0],params[2]));
+        formatterRectangle.setUpperRightY(Math.max(params[1],params[3]));
 
         pdfStructure.setFormatterRectangle(formatterRectangle);
         LOG.info("Formatter rectangle has been created");