pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1864276 - /pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java
Date Fri, 02 Aug 2019 18:33:15 GMT
Author: tilman
Date: Fri Aug  2 18:33:15 2019
New Revision: 1864276

URL: http://svn.apache.org/viewvc?rev=1864276&view=rev
Log:
PDFBOX-4071: simplify code

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

Modified: pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java?rev=1864276&r1=1864275&r2=1864276&view=diff
==============================================================================
--- pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java
(original)
+++ pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java
Fri Aug  2 18:33:15 2019
@@ -292,11 +292,7 @@ public final class PDAcroForm implements
         {
             refreshAppearances(fields);
         }
-        
-        // indicates if the original content stream
-        // has been wrapped in a q...Q pair.
-        boolean isContentStreamWrapped;
-        
+
         // the content stream to write to
         PDPageContentStream contentStream;
 
@@ -307,7 +303,10 @@ public final class PDAcroForm implements
         for (PDPage page : document.getPages())
         {
             Map<COSDictionary,PDAnnotationWidget> widgetsForPageMap = pagesWidgetsMap.get(page.getCOSObject());
-            isContentStreamWrapped = false;
+
+            // indicates if the original content stream
+            // has been wrapped in a q...Q pair.
+            boolean isContentStreamWrapped = false;
             
             List<PDAnnotation> annotations = new ArrayList<PDAnnotation>();
             
@@ -319,15 +318,8 @@ public final class PDAcroForm implements
                 }
                 else if (!annotation.isInvisible() && !annotation.isHidden() &&
annotation.getNormalAppearanceStream() != null)
                 {
-                    if (!isContentStreamWrapped)
-                    {
-                        contentStream = new PDPageContentStream(document, page, AppendMode.APPEND,
true, true);
-                        isContentStreamWrapped = true;
-                    }
-                    else
-                    {
-                        contentStream = new PDPageContentStream(document, page, AppendMode.APPEND,
true);
-                    }
+                    contentStream = new PDPageContentStream(document, page, AppendMode.APPEND,
true, !isContentStreamWrapped);
+                    isContentStreamWrapped = true;
                     
                     PDAppearanceStream appearanceStream = annotation.getNormalAppearanceStream();
                     



Mime
View raw message