ralphcook wrote:
> I have code that fills in fields in a PDF form, it works fine.  I can fill
> each field, I can align each field as either left or center, THAT works
> fine.

OK.

> I have trouble determining, from the information in the form, when a field
> is designated as aligned for center or left (I don't have any need to do
> right-align at this time).
> 
> The nearest field attribute/characteristic/whatever it is called in
> AcroFields I could find was "/Q", though that seems to reference
> justification, not alignment.  I wrote code that detects what the value of Q
> is and sets alignment according to it, but that doesn't match alignment for
> some fields.  

OK, for clarification, this is what the PDF Reference says:

/Q: A code specifying the form of quadding (justification) to be used
in displaying the text:
0 Left-justified
1 Centered
2 Right-justified

> I had fields in this form that used to be centered, the person who maintains
> the forms has changed these fields to say they are left-aligned, I can bring
> up the form in PDF reader and click in them, and my cursor is left aligned,
> but when I read the info for the field, /Q indicates data for the field
> indicating it is supposed to be centered.

Do you have an example of such a form?
Do the values mentioned above correspond with your findings?
(In other words: is the value for /Q 0 or 1?)

> I can't find where alignment might otherwise be given. 

Aligment can be inherited, but if you find a /Q value
for a field, that /Q value applies.

> Can someone please
> point me to the place, or to a place where the place is explained? To
> restate, I want the information on the field in a form to say what alignment
> it is supposed to have, and know how to read that in iText so I can put the
> same alignment on the field.

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.

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.

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.
-- 
This answer is provided by 1T3XT BVBA

-------------------------------------------------------------------------
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