I suspect your fields have a "default appearance" string that defines
RGB or G(ray).  To change that... Ouch.  Let see.

Okay, to see if I'm right:

>               while (i.hasNext()) {
> 
>                       key = i.next();
>                       
>                       form1.setField(key, values.get(key));
                  // start new code
                        AcroFields.Item fldItem = form1.getFieldItem(
key );
                  PdfDictionary merged = fldItem.getMerged(0);

                  // insert your favorite debug message handler thingy
here
                  DumpToConsole( merged.get(PdfName.DA).toString() );
                  // end new code
> 
>               }

Now to FIX IT... Hmm...  Aha!

                  // an easy one, here's black.
                  form1.setFieldProperty(key, "textcolor", new
CMYKColor( 0, 0, 0, 1.0f), null);

I really think we ought to break out the different setFieldProperty
properties into their own functions.  Looking at the function name
doesn't make it obvious what it can or cannot do.

--Mark Storer
  Senior Software Engineer
  Cardiff.com
 
import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;
 
 

> -----Original Message-----
> From: Mark Schmidt [mailto:[email protected]] 
> Sent: Thursday, August 26, 2010 9:07 AM
> To: [email protected]
> Subject: [iText-questions] Problem with iText, PDFSTamper and CMYK/RGB
> 
> Hi All,
> 
> I have a huge Problem with PDFSTamper and a conversion to RGB.
> 
> I have a PDF File with some fields in it, made in InDesign 
> and Acrobat Pro 9 for the fields. Text color ist set to white 
> or black.
> 
> Now I fill these fields:
> 
> PdfStamper stamp1 = new PdfStamper(reader, output);
>               
>               
>               AcroFields form1 = stamp1.getAcroFields();
>               
>               stamp1.setFormFlattening(true);
>               
>               Set<String> keys = values.keySet();
>               Iterator<String> i = keys.iterator();
>               String key;
>               while (i.hasNext()) {
> 
>                       key = i.next();
>                       
>                       form1.setField(key, values.get(key));
> 
>               }
> 
>               stamp1.close();
> 
> 
> So far so good. The only Problem ist, that when I flatten the 
> fields, they are converted to RGB somehow. This is a problem 
> for printing, cause all the other text on the page is CMYK. 
> 
> Does anyone have any idea why this is happening? How I I 
> setup CMYK for these fields? I tried using:
> 
> stamp1.getWriter().setDefaultColorspace(PdfName.DEFAULTCMYK, null);
> 
> with no effect.
> 
> Thanks a lot in advance for your help!
> 
> Best regards
> 
> Mark Schmidt
> 
> 
> --------------------------------------------------------------
> ----------------
> Sell apps to millions through the Intel(R) Atom(Tm) Developer 
> Program Be part of this innovative community and reach 
> millions of netbook users worldwide. Take advantage of 
> special opportunities to increase revenue and speed 
> time-to-market. Join now, and jumpstart your future.
> http://p.sf.net/sfu/intel-atom-d2d
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> Buy the iText book: http://www.itextpdf.com/book/ Check the 
> site with examples before you ask questions: 
> http://www.1t3xt.info/examples/ You can also search the 
> keywords list: http://1t3xt.info/tutorials/keywords/
> 
> 
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 9.0.851 / Virus Database: 271.1.1/3091 - Release 
> Date: 08/25/10 11:34:00
> 

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to