pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msahy...@apache.org
Subject svn commit: r1690611 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel: PDDocument.java interactive/digitalsignature/visible/PDVisibleSigBuilder.java
Date Mon, 13 Jul 2015 09:28:35 GMT
Author: msahyoun
Date: Mon Jul 13 09:28:35 2015
New Revision: 1690611

URL: http://svn.apache.org/r1690611
Log:
PDFBOX-2852: don't use deprecated getWidget method internally

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java?rev=1690611&r1=1690610&r2=1690611&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java Mon Jul 13
09:28:35 2015
@@ -249,12 +249,12 @@ public class PDDocument implements Close
             // set visibility flags
             if (options.getVisualSignature() == null)
             {
-                signatureField.getWidget().setAnnotationFlags(PDAnnotationWidget.FLAG_NO_VIEW);
+                signatureField.getWidgets().get(0).setAnnotationFlags(PDAnnotationWidget.FLAG_NO_VIEW);
             }
             // append the signature object
             signatureField.setValue(sigObject);
             // backward linking
-            signatureField.getWidget().setPage(page);
+            signatureField.getWidgets().get(0).setPage(page);
         }
 
         // Set the AcroForm Fields
@@ -285,7 +285,7 @@ public class PDDocument implements Close
               ((COSArrayList) annotations).toList().equals(((COSArrayList) acroFormFields).toList())
&&
               checkFields))
         {
-            annotations.add(signatureField.getWidget());
+            annotations.add(signatureField.getWidgets().get(0));
         }
         page.getCOSObject().setNeedToBeUpdated(true);
     }
@@ -379,7 +379,7 @@ public class PDDocument implements Close
         // Read and set the Rectangle for visual signature
         COSArray rectAry = (COSArray) cosBaseDict.getDictionaryObject(COSName.RECT);
         PDRectangle rect = new PDRectangle(rectAry);
-        signatureField.getWidget().setRectangle(rect);
+        signatureField.getWidgets().get(0).setRectangle(rect);
     }
 
     private void assignAppearanceDictionary(PDSignatureField signatureField, COSDictionary
dict)
@@ -388,7 +388,7 @@ public class PDDocument implements Close
         PDAppearanceDictionary ap
                 = new PDAppearanceDictionary((COSDictionary) dict.getDictionaryObject(COSName.AP));
         ap.getCOSObject().setDirect(true);
-        signatureField.getWidget().setAppearance(ap);
+        signatureField.getWidgets().get(0).setAppearance(ap);
     }
 
     private void assignAcroFormDefaultResource(PDAcroForm acroForm, COSDictionary dict)
@@ -408,7 +408,7 @@ public class PDDocument implements Close
             throws IOException
     {
         // Set rectangle for non-visual signature to rectangle array [ 0 0 0 0 ]
-        signatureField.getWidget().setRectangle(new PDRectangle());
+        signatureField.getWidgets().get(0).setRectangle(new PDRectangle());
         // Clear AcroForm / Set DefaultRessource
         acroForm.setDefaultResources(null);
         // Set empty Appearance-Dictionary
@@ -424,7 +424,7 @@ public class PDDocument implements Close
         
         ap.setNormalAppearance(aps);
         ap.getCOSObject().setDirect(true);
-        signatureField.getWidget().setAppearance(ap);
+        signatureField.getWidgets().get(0).setAppearance(ap);
     }
 
     /**

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java?rev=1690611&r1=1690610&r2=1690611&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java
Mon Jul 13 09:28:35 2015
@@ -104,8 +104,8 @@ public class PDVisibleSigBuilder impleme
     {
         PDSignature pdSignature = new PDSignature();
         pdSignatureField.setValue(pdSignature);
-        pdSignatureField.getWidget().setPage(page);
-        page.getAnnotations().add(pdSignatureField.getWidget());
+        pdSignatureField.getWidgets().get(0).setPage(page);
+        page.getAnnotations().add(pdSignatureField.getWidgets().get(0));
         pdSignature.setName(signatureName);
         pdSignature.setByteRange(new int[] { 0, 0, 0, 0 });
         pdSignature.setContents(new byte[4096]);
@@ -141,7 +141,7 @@ public class PDVisibleSigBuilder impleme
         rect.setLowerLeftY(properties.getTemplateHeight() - properties.getyAxis() -
                            properties.getHeight());
         rect.setLowerLeftX(properties.getxAxis());
-        signatureField.getWidget().setRectangle(rect);
+        signatureField.getWidgets().get(0).setRectangle(rect);
         pdfStructure.setSignatureRectangle(rect);
         log.info("rectangle of signature has been created");
     }
@@ -228,7 +228,7 @@ public class PDVisibleSigBuilder impleme
         PDAppearanceStream appearanceStream = new PDAppearanceStream(holderForml.getCOSStream());
 
         appearance.setNormalAppearance(appearanceStream);
-        signatureField.getWidget().setAppearance(appearance);
+        signatureField.getWidgets().get(0).setAppearance(appearance);
 
         pdfStructure.setAppearanceDictionary(appearance);
         log.info("PDF appereance Dictionary has been created");
@@ -363,7 +363,7 @@ public class PDVisibleSigBuilder impleme
     public void createWidgetDictionary(PDSignatureField signatureField,
                                        PDResources holderFormResources) throws IOException
     {
-        COSDictionary widgetDict = signatureField.getWidget().getCOSObject();
+        COSDictionary widgetDict = signatureField.getWidgets().get(0).getCOSObject();
         widgetDict.setNeedToBeUpdated(true);
         widgetDict.setItem(COSName.DR, holderFormResources.getCOSObject());
 



Mime
View raw message