Hi,

PDF spec allows key color transparency for all image types. There is no need
to ignore transparency settings for DCTDecode as it is the case now. This
patch fixes the issue:


--- originals/com/itextpdf/text/pdf/PdfImage.java       2013-05-31
12:30:32.000000000 +0300
+++ itextpdf-5.4.2-sources/com/itextpdf/text/pdf/PdfImage.java  2013-08-27
13:41:14.000000000 +0300
@@ -102,18 +102,18 @@
             put(PdfName.INTERPOLATE, PdfBoolean.PDFTRUE);
         InputStream is = null;
         try {
+            int transparency[] = image.getTransparency();
+            if (transparency != null && !image.isMask() && maskRef == null) {
+                StringBuilder s = new StringBuilder("[");
+                for (int k = 0; k < transparency.length; ++k)
+                    s.append(transparency[k]).append(" ");
+                s.append("]");
+                put(PdfName.MASK, new PdfLiteral(s.toString()));
+            }
             // Raw Image data
             if (image.isImgRaw()) {
                 // will also have the CCITT parameters
                 int colorspace = image.getColorspace();
-                int transparency[] = image.getTransparency();
-                if (transparency != null && !image.isMask() && maskRef ==
null) {
-                    StringBuilder s = new StringBuilder("[");
-                    for (int k = 0; k < transparency.length; ++k)
-                        s.append(transparency[k]).append(" ");
-                    s.append("]");
-                    put(PdfName.MASK, new PdfLiteral(s.toString()));
-                }
                 bytes = image.getRawData();
                 put(PdfName.LENGTH, new PdfNumber(bytes.length));
                 int bpc = image.getBpc();


-- 
Ivan



------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to