> 
> The first thing that came to mind, was that the DA (Default Appearance)
> had a different alignment, causing confusion. The DA is what the field
> looks like before you click it, and it can happen that the DA shows the
> text aligned in one way, while the field's /Q value says the alignment
> should be another way. As soon as you click on the field and change it,
> the /Q value should be respected.

In my normal situation, no one ever clicks on this field. We have a forms
person who creates the "interactive" forms, but they are filled in with data
using my program.  I referred to clicking on the field only as a way of
verifying what the field's setting was.  

I wonder how (or whether) the program used to create this field provides for
the "DA" settings.  

> However, from your question I understand that the alignment is wrong
> at the moment you click it. The only thing I can think of right now,
> is that there's more than one field with the same name. Maybe an extra
> field with a different alignment was added; maybe you are looking at
> the wrong field? By the way: how are you looking at the field? Are you
> using iText, or are you looking at it in a text editor. If the latter,
> maybe the PDF was updated incrementally, in which case you should ignore
> the 'old' field dictionary, and look for the 'new' field dictionary more
> towards the end of the file.

If I bring up the form (in Adobe Reader) and click on the field to see its
alignment, it shows up correctly as left-justified; I say correctly because
this is what the person creating the form specified.  If instead I read the
PDF file with my program using the iText classes, and use
PdfReader.getAcroFields() to get information for the fields, this field's Q
value is present and equals 1 (should be centered).

The person creating the form is using a WYSISWYG editor which name I do not
remember; There is an attribute for alignment she can set on the field to
indicate "left-aligned", but it seems not to be reflected in the Q value I
read.  Either it sets some other value, or perhaps it sets Q
"incrementally".  I'll have to check on that in a couple of days when the
forms person is back in the office (I don't have access to the forms
program).  Is there an easy way to tell about incremental settings, looking
at the form?  All I know to do is look in the help for the program and see
if it mentions incremental saving of attributes.

If it does set it incrementally, how do I go about reading a "later"
setting? My program uses PdfReader.getAcroFields(), and goes through it
field-by-field -- I would expect that, if there are "incremental" settings
in the form, that getAcroFields() would get them.  Is there anything else I
should (or can) do to get a later, incremental setting?

Good thought on the duplicate field name, but I checked and there's no other
(I wrote a program to dump all the field names to a file, then I sorted and
looked for duplicates, esp. of the field in question.)  (I'm going to have
to think about dupe field names; your question made me realize that my
current program assumes a unique name for each field on the form.)

Another odd thing: some of the fields on the form are behaving as I
expected: my program reads the Q value and make the fields centered or left
according to it, and they are left or centered appropriately.  This gives a
little support to the "incremental" idea, since the fields that are not
working are ones that I asked the forms person to change recently.

> This is, of course, just me guessing. In response to your question
> for the documentation: the /Q key in the field dictionary is explained
> on p678 of the PDF Reference.

I think I must have a different version than you; I'm looking at page 678 of
the PDF reference, and it's in the middle of section "9.10.1  Page
Boundaries", with a graphic showing the art box, trim box, etc. for a page. 
I did a search starting a page or two above for the letter Q and didn't find
any description.  The precise definition does not appear to be the answer to
my question anyway.

> -- 
> This answer is provided by 1T3XT BVBA

-- 
View this message in context: 
http://www.nabble.com/want-to-detect-field-alignment-when-filling-in-a-form-tp16852535p16915707.html
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to