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 2022/06/12 08:14:22 UTC

svn commit: r1901838 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java

Author: tilman
Date: Sun Jun 12 08:14:22 2022
New Revision: 1901838

URL: http://svn.apache.org/viewvc?rev=1901838&view=rev
Log:
PDFBOX-4892: remove spaces, as suggested by Valery Bokov

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java?rev=1901838&r1=1901837&r2=1901838&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java Sun Jun 12 08:14:22 2022
@@ -63,13 +63,13 @@ import org.apache.pdfbox.util.Matrix;
 public final class PDAcroForm implements COSObjectable
 {
     private static final Log LOG = LogFactory.getLog(PDAcroForm.class);
-    
+
     private static final int FLAG_SIGNATURES_EXIST = 1;
     private static final int FLAG_APPEND_ONLY = 1 << 1;
 
     private final PDDocument document;
     private final COSDictionary dictionary;
-    
+
     private Map<String, PDField> fieldCache;
 
     private ScriptingHandler scriptingHandler;
@@ -107,7 +107,7 @@ public final class PDAcroForm implements
     {
         return document;
     }
-    
+
     @Override
     public COSDictionary getCOSObject()
     {
@@ -158,9 +158,9 @@ public final class PDAcroForm implements
         {
             fdfFields.add(field.exportFDF());
         }
-        
+
         fdfDict.setID(document.getDocument().getDocumentID());
-        
+
         if (!fdfFields.isEmpty())
         {
             fdfDict.setFields(fdfFields);
@@ -190,7 +190,7 @@ public final class PDAcroForm implements
             LOG.warn("Flatten for a dynamix XFA form is not supported");
             return;
         }
-        
+
         List<PDField> fields = new ArrayList<PDField>();
         for (PDField field: getFieldTree())
         {
@@ -198,8 +198,8 @@ public final class PDAcroForm implements
         }
         flatten(fields, false);
     }
-    
-    
+
+
     /**
      * This will flatten the specified form fields.
      * 
@@ -220,7 +220,7 @@ public final class PDAcroForm implements
         {
             return;
         }
-        
+
         if (!refreshAppearances && getNeedAppearances())
         {
             LOG.warn("acroForm.getNeedAppearances() returns true, " +
@@ -236,7 +236,7 @@ public final class PDAcroForm implements
             LOG.warn("Flatten for a dynamix XFA form is not supported");
             return;
         }
-        
+
         // refresh the appearances if set
         if (refreshAppearances)
         {
@@ -246,7 +246,7 @@ public final class PDAcroForm implements
         // get the widgets per page
         PDPageTree pages = document.getPages();
         Map<COSDictionary,Set<COSDictionary>> pagesWidgetsMap = buildPagesWidgetsMap(fields, pages);
-        
+
         // preserve all non widget annotations
         for (PDPage page : document.getPages())
         {
@@ -255,14 +255,14 @@ public final class PDAcroForm implements
             // indicates if the original content stream
             // has been wrapped in a q...Q pair.
             boolean isContentStreamWrapped = false;
-            
+
             List<PDAnnotation> annotations = new ArrayList<PDAnnotation>();
-            
+
             for (PDAnnotation annotation: page.getAnnotations())
             {
                 if (widgetsForPageMap == null || !widgetsForPageMap.contains(annotation.getCOSObject()))
                 {
-                    annotations.add(annotation);                 
+                    annotations.add(annotation);
                 }
                 else if (isVisibleAnnotation(annotation))
                 {
@@ -295,10 +295,10 @@ public final class PDAcroForm implements
             }
             page.setAnnotations(annotations);
         }
-        
+
         // remove the fields
         removeFields(fields);
-        
+
         // remove XFA for hybrid forms
         dictionary.removeItem(COSName.XFA);
 
@@ -358,8 +358,8 @@ public final class PDAcroForm implements
             }
         }
     }
-    
-    
+
+
     /**
      * This will return all of the documents root fields.
      * 
@@ -405,7 +405,7 @@ public final class PDAcroForm implements
     {
         dictionary.setItem(COSName.FIELDS, COSArrayList.converterToCOSArray(fields));
     }
-    
+
     /**
      * Returns an iterator which walks all fields in the field tree, in order.
      */
@@ -420,8 +420,8 @@ public final class PDAcroForm implements
     public PDFieldTree getFieldTree()
     {
         return new PDFieldTree(this);
-    }    
-    
+    }
+
     /**
      * This will tell this form to cache the fields into a Map structure
      * for fast access via the getField method.  The default is false.  You would
@@ -479,7 +479,7 @@ public final class PDAcroForm implements
                 return field;
             }
         }
-        
+
         return null;
     }
 
@@ -524,7 +524,7 @@ public final class PDAcroForm implements
     {
         dictionary.setBoolean(COSName.NEED_APPEARANCES, value);
     }
-    
+
     /**
      * This will get the default resources for the AcroForm.
      *
@@ -570,7 +570,7 @@ public final class PDAcroForm implements
     {
         return hasXFA() && getFields().isEmpty();
     }
-    
+
     /**
      * Get the XFA resource, the XFA resource is only used for PDF 1.5+ forms.
      *
@@ -596,7 +596,7 @@ public final class PDAcroForm implements
     {
         dictionary.setItem(COSName.XFA, xfa);
     }
-    
+
     /**
      * This will get the document-wide default value for the quadding/justification of variable text
      * fields. 
@@ -689,7 +689,7 @@ public final class PDAcroForm implements
     {
         this.scriptingHandler = scriptingHandler;
     }
-    
+
     private Matrix resolveTransformationMatrix(PDAnnotation annotation, PDAppearanceStream appearanceStream)
     {
         // 1st step transform appearance stream bbox with appearance stream matrix
@@ -715,7 +715,7 @@ public final class PDAcroForm implements
     private Rectangle2D getTransformedAppearanceBBox(PDAppearanceStream appearanceStream)
     {
         Matrix appearanceStreamMatrix = appearanceStream.getMatrix();
-        PDRectangle appearanceStreamBBox = appearanceStream.getBBox();        
+        PDRectangle appearanceStreamBBox = appearanceStream.getBBox();
         GeneralPath transformedAppearanceBox = appearanceStreamBBox.transform(appearanceStreamMatrix);
         return transformedAppearanceBox.getBounds2D();
     }
@@ -726,7 +726,7 @@ public final class PDAcroForm implements
         Map<COSDictionary,Set<COSDictionary>> pagesAnnotationsMap =
                 new HashMap<COSDictionary, Set<COSDictionary>>();
         boolean hasMissingPageRef = false;
-        
+
         for (PDField field : fields)
         {
             List<PDAnnotationWidget> widgets = field.getWidgets();