pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1799766 - /pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/signature/CreateVisibleSignature.java
Date Sat, 24 Jun 2017 11:56:09 GMT
Author: tilman
Date: Sat Jun 24 11:56:09 2017
New Revision: 1799766

URL: http://svn.apache.org/viewvc?rev=1799766&view=rev
Log:
PDFBOX-3820: add methods for signing existing signature fields, as suggested by Lonzak

Modified:
    pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/signature/CreateVisibleSignature.java

Modified: pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/signature/CreateVisibleSignature.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/signature/CreateVisibleSignature.java?rev=1799766&r1=1799765&r2=1799766&view=diff
==============================================================================
--- pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/signature/CreateVisibleSignature.java
(original)
+++ pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/signature/CreateVisibleSignature.java
Sat Jun 24 11:56:09 2017
@@ -73,6 +73,17 @@ public class CreateVisibleSignature exte
         this.lateExternalSigning = lateExternalSigning;
     }
 
+    /**
+     * Set visible signature designer for a new signature field.
+     * 
+     * @param filename
+     * @param x position of the signature field
+     * @param y position of the signature field
+     * @param zoomPercent
+     * @param imageStream
+     * @param page the signature should be placed on
+     * @throws IOException
+     */
     public void setVisibleSignDesigner(String filename, int x, int y, int zoomPercent, 
             FileInputStream imageStream, int page) 
             throws IOException
@@ -81,6 +92,31 @@ public class CreateVisibleSignature exte
         visibleSignDesigner.xAxis(x).yAxis(y).zoom(zoomPercent).adjustForRotation();
     }
     
+    /**
+     * Set visible signature designer for an existing signature field.
+     * 
+     * @param zoomPercent
+     * @param imageStream
+     * @throws IOException
+     */
+    public void setVisibleSignDesigner(int zoomPercent, FileInputStream imageStream) 
+            throws IOException
+    {
+        visibleSignDesigner = new PDVisibleSignDesigner(imageStream);
+        visibleSignDesigner.zoom(zoomPercent);
+    }
+    
+    /**
+     * Set visible signature properties for new signature fields.
+     * 
+     * @param name
+     * @param location
+     * @param reason
+     * @param preferredSize
+     * @param page
+     * @param visualSignEnabled
+     * @throws IOException
+     */
     public void setVisibleSignatureProperties(String name, String location, String reason,
int preferredSize, 
             int page, boolean visualSignEnabled) throws IOException
     {
@@ -88,6 +124,22 @@ public class CreateVisibleSignature exte
                 preferredSize(preferredSize).page(page).visualSignEnabled(visualSignEnabled).
                 setPdVisibleSignature(visibleSignDesigner);
     }
+    
+    /**
+     * Set visible signature properties for existing signature fields.
+     * 
+     * @param name
+     * @param location
+     * @param reason
+     * @param visualSignEnabled
+     * @throws IOException
+     */
+    public void setVisibleSignatureProperties(String name, String location, String reason,
+            boolean visualSignEnabled) throws IOException
+    {
+        visibleSignatureProperties.signerName(name).signerLocation(location).signatureReason(reason).
+                visualSignEnabled(visualSignEnabled).setPdVisibleSignature(visibleSignDesigner);
+    }
 
     /**
      * Initialize the signature creator with a keystore (pkcs12) and pin that



Mime
View raw message