pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1857054 - /pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java
Date Sat, 06 Apr 2019 17:17:32 GMT
Author: tilman
Date: Sat Apr  6 17:17:32 2019
New Revision: 1857054

URL: http://svn.apache.org/viewvc?rev=1857054&view=rev
Log:
PDFBOX-45: add implementation notes for future devs

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

Modified: pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java?rev=1857054&r1=1857053&r2=1857054&view=diff
==============================================================================
--- pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java
(original)
+++ pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java
Sat Apr  6 17:17:32 2019
@@ -269,6 +269,19 @@ public class COSWriter implements ICOSVi
     public COSWriter(OutputStream outputStream, RandomAccessRead inputData,
             Set<COSDictionary> objectsToWrite) throws IOException
     {
+        // Implementation notes / summary of April 2019 comments in PDFBOX-45:
+        // we allow only COSDictionary in objectsToWrite because other types, 
+        // especially COSArray, are written directly. If we'd allow them with the current
+        // COSWriter implementation, they would be written twice,
+        // once directly and once indirectly as orphan.
+        // One could improve visitFromArray and visitFromDictionary (see commit 1856891)
+        // to handle arrays like dictionaries so that arrays are written indirectly,
+        // but this produces very inefficient files.
+        // If there is every a real need to update arrays, then a future implementation could
+        // recommit change 1856891 (also needs to move the byteRange position detection code)
+        // and also set isDirect in arrays to true by default, to avoid inefficient files.
+        // COSArray.setDirect(true) is called at some places in the current implementation
for
+        // documentational purposes only.
         this(outputStream, inputData);
         this.objectsToWrite.addAll(objectsToWrite);
     }



Mime
View raw message