pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1719974 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java
Date Mon, 14 Dec 2015 17:50:27 GMT
Author: tilman
Date: Mon Dec 14 17:50:27 2015
New Revision: 1719974

URL: http://svn.apache.org/viewvc?rev=1719974&view=rev
Log:
PDFBOX-3114: keep indirect structures when doing incremental update

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java?rev=1719974&r1=1719973&r2=1719974&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java Mon
Dec 14 17:50:27 2015
@@ -928,7 +928,7 @@ public class COSWriter implements ICOSVi
                 else if( current instanceof COSObject )
                 {
                     COSBase subValue = ((COSObject)current).getObject();
-                    if( subValue instanceof COSDictionary || subValue == null )
+                    if (incrementalUpdate || subValue instanceof COSDictionary || subValue
== null)
                     {
                         addObjectToWrite( current );
                         writeReference( current );
@@ -1024,16 +1024,19 @@ public class COSWriter implements ICOSVi
                     {
                         COSDictionary dict = (COSDictionary)value;
                         
-                        // write all XObjects as direct objects, this will save some size
-                        COSBase item = dict.getItem(COSName.XOBJECT);
-                        if(item!=null)
+                        if (!incrementalUpdate)
                         {
-                            item.setDirect(true);
-                        }
-                        item = dict.getItem(COSName.RESOURCES);
-                        if(item!=null)
-                        {
-                            item.setDirect(true);
+                            // write all XObjects as direct objects, this will save some
size
+                            COSBase item = dict.getItem(COSName.XOBJECT);
+                            if (item != null)
+                            {
+                                item.setDirect(true);
+                            }
+                            item = dict.getItem(COSName.RESOURCES);
+                            if (item != null)
+                            {
+                                item.setDirect(true);
+                           }
                         }
 
                         if(dict.isDirect()) 
@@ -1051,7 +1054,7 @@ public class COSWriter implements ICOSVi
                     else if( value instanceof COSObject )
                     {
                         COSBase subValue = ((COSObject)value).getObject();
-                        if( subValue instanceof COSDictionary || subValue == null )
+                        if (incrementalUpdate || subValue instanceof COSDictionary || subValue
== null)
                         {
                             addObjectToWrite( value );
                             writeReference( value );



Mime
View raw message