thanks for your reply..

I'll try to explain it better...

1- build a pdf template using AcroForms with some text fields

2- the pdf template is upload to my web application and parses the pdf
template that have de AcroForm and presents the fields that have been
found on it on an HTML form

3- The user can specify on the HTML form for each field  if it will be
used with an Image or text

     3.1- if Text is selected, user can select the font (available on
filesystem ) , the size, font CMYK font Color, alignment (0-LEFT,
1-CENTER, 2-RIGHT) and ENTER SOME TEXT for that field...

     3.2 - if image.... he can select an image from filesystem and
assign it to that field scalling it to available area

4- The user filled all Fields on HTML form that have been found from
PDF (template) parsing and will HIT SAVE!

5 - The application collects all user data that have been submited
from HTML form and starts To reproduce a copy of temlate PDF filled
with that data (STAMPER)

5 - The PDF is saved flaten , so it can not be anymore changed (not
editable anymore).

Some code as example:

PdfReader reader = new PdfReader(filename);
                
PdfStamper stamper = new PdfStamper(reader, out);

//stamper.getWriter().setRgbTransparencyBlending(true);  //this was
Paulo Soares previous sugestion, nothing changes

Font[] fonts = new Font[2];    //Simulation for user selected fonts
FontFactory.register("fonts/BUMBAZO.ttf", "BUMBAZO");
FontFactory.register("fonts/BORINGLE.ttf", "BORINGLE");
fonts[0] = FontFactory.getFont("BUMBAZO", BaseFont.CP1252,
BaseFont.EMBEDDED, 10);
fonts[1] = FontFactory.getFont("BORINGLE", BaseFont.CP1252,
BaseFont.EMBEDDED, 10);
                
AcroFields form = stamper.getAcroFields();

for each field found --- > apply html submission of values for each
one of fields

//Example -> fill field type found on AcroForm

PdfDictionary dictionary = form.getFieldItem("type").getMerged(0);


//User entered Align Center to the entered TEXT ---> 1
dictionary.put(PdfName.Q, new PdfNumber(1)); //0-align left, 1-align
at center, 2-align right

//user entered on HTML form 0 , 76 , 76 , 70 for the text color --->
Create CMYKColor with those values
Color currentColor = new CMYKColor(0, 76, 76, 70);
form.setFieldProperty("type", "textcolor",currentColor, null);
//apply font color on text field

//User entered font size of 8 ( ehere maybe use to utilities for
conversion for mm and points)
form.setFieldProperty("type", "textsize", new Float(8), null);
//apply font size on text field


//User selected font file ---> /user/fonts/BUMBAZO.ttf  from filesystem
Font[] fonts = new Font[1];
FontFactory.register("fonts/BORINGLE.ttf", "BORINGLE");
fonts[0] = FontFactory.getFont("BORINGLE", BaseFont.CP1252,
BaseFont.EMBEDDED, 10);

form.setFieldProperty("type","textfont", fonts[0].getBaseFont(),
null);   //apply selected font on text field
//form.setFieldProperty("type", "bgcolor", COLOR[4], null);
     //apply backgroung color on text field

String fieldText = "This is a test!!!!!";           //assume that this
is the text entered by the user for this text field
form.setField("type", fieldText);


//when all fields have been processed...  do final stuff as flatten
the output pdf
stamper.setFormFlattening(true);
stamper.close();


And that's it, the thing is that the color is really important and I'm
getting issues with that as I explain on my previous emails.

If the user select CMYK(0, 76, 76, 70)  for that field... when I final
result PDF on Photoshop / GIMP , I color there is not the one
expected... I use them only to check the color because the user have
complained that the print result is not what he expects!


Hope with this gets clear for you... I don't kow what to do anymore... :(


Thanks in advance and I apreciate a lot your effort to help me.

BR

Hugo





On Fri, Oct 9, 2009 at 3:00 PM, Leonard Rosenthol <lrose...@adobe.com> wrote:
> So there are a bunch of fields in the PDF you sent - which one am I supposed
> to be looking at?
>
> None of them have ANY CMYK values associated with them that I see.  What
> EXACTLY are you doing in your code to set this value?  Text?  Image?
> Vector?
>
> We really aren't understanding what you've done (or are trying to do) and
> what you are expecting...
>
> Leonard
>
>
> On 10/9/09 9:15 AM, "Hugo Flambó" <hfla...@gmail.com> wrote:
>
>> Yes in that one there are not...they are Flatten by the stamper...
>> because this one is the output which I don't want to be edited
>> anymore.
>> If i open the PDF ..not on PhotoShop now but on GIMP for example... It
>> says that color is another too...
>> I add a screenshot about it!!
>>
>> Maybe GIMP is not good too...but I have somehow to check if colors are
>> the ones pretended... this PDF's for a printing office
>> and the output must be the one specified...
>>
>> Any way to test it?
>>
>> Thanks in advance.
>>
>>
>>
>> On Fri, Oct 9, 2009 at 1:10 PM, Leonard Rosenthol <lrose...@adobe.com> wrote:
>>> There are no form fields on that document - what are you referring to??
>>>
>>> Leonard
>>>
>>> -----Original Message-----
>>> From: Hugo Flambó [mailto:hfla...@gmail.com]
>>> Sent: Friday, October 09, 2009 7:38 AM
>>> To: itext-questions@lists.sourceforge.net
>>> Subject: Re: [iText-questions] CMYKColor on iText bug? PHOTOSHOP says it is 
>>> a
>>> different color!
>>>
>>> Just to add PDF generated sample
>>>
>>> On Fri, Oct 9, 2009 at 12:25 PM, Hugo Flambó <hfla...@gmail.com> wrote:
>>>> I use the iText AcroForms and AcroFields to fill it somo content from
>>>> iText I define the color:
>>>>
>>>> CMYKColor(0,76,76,70) and generated PDF seams to be ok but when I open
>>>> the generated PDF on Photoshop it says that the color is
>>>> CMYK(0,30,30,27) and the print result is not the one expected.
>>>>
>>>> Can someone help me and try to reproduce this issue? This seams to me
>>>> to be a bug...
>>>>
>>>> Thanks in advance!
>>>>
>>>> BR
>>>>
>>>> Hugo
>>>>
>>>
>>>
> ----------------------------------------------------------------------------->>
> -
>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and stay
>>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>>> http://p.sf.net/sfu/devconference
>>> _______________________________________________
>>> iText-questions mailing list
>>> iText-questions@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>>
>>> Buy the iText book: http://www.1t3xt.com/docs/book.php
>>> 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/
>>>
>
> --
> Leonard Rosenthol
> PDF Standards Architect
> Adobe Systems
>
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> 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/
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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