I had a similar problem with formfields and Greek characters.
I found out that by using a common truetype font like Arial or Verdana as
the fields default font when I created the pdf templates in designer it
solved the problem.
I didn't need to change any codepage or use unicode syntax (\uxxxx) to
display the text.


2007/5/26, Paulo Soares <[EMAIL PROTECTED]>:

I can only tell you that your source codepage doesn't match your compiler
codepage, it all depends on your environment and I know nothing about it.

Paulo

----- Original Message -----
From: "David Foix" <[EMAIL PROTECTED]>
To: "'Post all your questions about iText here'"
<[email protected]>
Sent: Saturday, May 26, 2007 6:29 PM
Subject: Re: [iText-questions] Fill acroform textbox with setfield



Thank you Paulo;

I get "abcÑ" on txtBox1...

Do you mean I should make a function to translate all my possible special
char ocurrences?


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paulo
Soares
Sent: sábado, 26 de mayo de 2007 19:22
To: Post all your questions about iText here
Subject: Re: [iText-questions] Fill acroform textbox with setfield

Try this:

form1.SetField("txtBox1", "abc" + ChrW(209))

Paulo

----- Original Message -----
From: "David Foix" <[EMAIL PROTECTED]>
To: "'Post all your questions about iText here'"
<[email protected]>
Sent: Saturday, May 26, 2007 3:53 PM
Subject: Re: [iText-questions] Fill acroform textbox with setfield


Thank you for your answer Paulo, but I can't figure out where to solve the
missing step you point me:

a) when desinging the "MyFormToFill.pdf" in Acrobat Designer? I can't find
where to set something like codepage. Only I could verify my textField and
form have the spanish locale selected.

b) when in vb.net code when I open the "MyFormToFill.pdf" with the
PdfStamper?

I need to solve it this way, as I should send string-register-variables to
"SetField" to fill the predesigned form.

David

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paulo
Soares
Sent: sábado, 26 de mayo de 2007 13:51
To: Post all your questions about iText here
Subject: Re: [iText-questions] Fill acroform textbox with setfield

iText supports Unicode in the fields but that's not your problem. If it
doesn't work in your example A) (and the others) that's because the source
file is being interpreted as ASCII or as some other codepage that is not
1252 and when it's compiled those characters disappear and iText never
sees
them. Try to set those characters as \uxxxx and see them appear.

Paulo

----- Original Message -----
From: "David Foix" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, May 26, 2007 9:41 AM
Subject: [iText-questions] Fill acroform textbox with setfield


Hello,

I am trying to fill a textfield in an acroform designed with Adobe
Designer
7.0

I've read many mailinglist posts related to this setfield method. They are
from the year 2005 and appear  various comments about "unicode is not
fully
supported in form fields.."

I am wondering if it is corrected by now or if there is a known
workaround.



The problem I am facing is related to spanish accentuated characters, that
get cut when filling the form with setfield.



Here is the code I am using:



Dim reader As New PdfReader("MyFormToFill.pdf")

Dim stamp1 As New PdfStamper(reader, New FileStream("MyFormFilled.pdf",
FileMode.Create))

Dim form1 As AcroFields = stamp1.AcroFields

form1.SetField("txtBox1", "àticó 1º1ª")



Always get the resulting form with the text "tic 11" in the textbox.



I also tried this other pieces of code with the same results.

A)

Dim bf As BaseFont = BaseFont.CreateFont(BaseFont.HELVETICA,
BaseFont.CP1252, BaseFont.NOT_EMBEDDED)

cb.BeginText()

cb.SetFontAndSize(bf, 10)

cb.SetTextMatrix(aSingles(1), aSingles(2))

cb.ShowText("àticó 1º1ª")

cb.EndText()

B)

Dim ph As New Phrase("àticó 1º1ª",
FontFactory.GetFont(FontFactory.HELVETICA, 10))

ColumnText.ShowTextAligned(cb, Element.ALIGN_LEFT, ph, aSingles(1) + 10,
aSingles(2) + 10, 0, PdfWriter.RUN_DIRECTION_LTR, 0)



I verified the font selected in the designer for "MyFormToFill.pdf", when
opened with acrobat reader, lets me introduce the text "àticó 1º1ª" as is.



Hopefully I am doing something wrong and setfield should be working,
please
give me some light..

Thank you,

David


-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to