Hello,

Currenlty, Document.compress==false will only prevent newly created
streams from being compressed.

The attached patch will also decompress already existing compressed
streams (imported from other PDF files).

This is useful especially for debugging files that have been created
previously or that have been created by another program.

Michael
Index: com/lowagie/text/pdf/PRStream.java
===================================================================
--- com/lowagie/text/pdf/PRStream.java  (revision 2865)
+++ com/lowagie/text/pdf/PRStream.java  (working copy)
@@ -174,6 +174,11 @@
     
     public void toPdf(PdfWriter writer, OutputStream os) throws IOException {
         byte[] b = PdfReader.getStreamBytesRaw(this);
+        if (!Document.compress) {
+               b = PdfReader.getStreamBytes(this);
+               remove(PdfName.FILTER);
+               remove(PdfName.DECODEPARMS);
+        }
         PdfEncryption crypto = null;
         if (writer != null)
             crypto = writer.getEncryption();
@@ -192,4 +197,4 @@
         }
         os.write(ENDSTREAM);
     }
-}
\ No newline at end of file
+}
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to