Return-Path: X-Original-To: apmail-pdfbox-commits-archive@www.apache.org Delivered-To: apmail-pdfbox-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3CA3018B22 for ; Mon, 14 Dec 2015 17:50:30 +0000 (UTC) Received: (qmail 30897 invoked by uid 500); 14 Dec 2015 17:50:30 -0000 Delivered-To: apmail-pdfbox-commits-archive@pdfbox.apache.org Received: (qmail 30872 invoked by uid 500); 14 Dec 2015 17:50:30 -0000 Mailing-List: contact commits-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pdfbox.apache.org Delivered-To: mailing list commits@pdfbox.apache.org Received: (qmail 30862 invoked by uid 99); 14 Dec 2015 17:50:30 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Dec 2015 17:50:30 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 947EFC1A54 for ; Mon, 14 Dec 2015 17:50:29 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.99 X-Spam-Level: X-Spam-Status: No, score=0.99 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id YyOKPwZE9nts for ; Mon, 14 Dec 2015 17:50:28 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTP id 4299520CB8 for ; Mon, 14 Dec 2015 17:50:28 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 5CA40E0044 for ; Mon, 14 Dec 2015 17:50:27 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 5DE633A024F for ; Mon, 14 Dec 2015 17:50:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@pdfbox.apache.org From: tilman@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20151214175027.5DE633A024F@svn01-us-west.apache.org> 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 );