I can't seem to find any later information on this issue, so anyway...

I've already long gone through the setExtraMargin solution for having to
manually set margins in form fields, however I'm working on a signed form
that needs some fields automatically filled out and have problems it can't
seem to solve.

The form has to pack a lot of information into very little space, while
still handling edge cases where a field has a lot of text entered (there is
a maximum character count, but its high for the space available). To this
end some of the fields are setup as multiline text fields, vertically
centered, that touch/overlap the grid. The idea is that 95% of input only
results in 1 or 2 lines of text in the field, which looks just fine centered
in the cell. When it hits an edge case, it wraps to 3 lines, in which case
the first and last lines will just barely fit, with letters touching the
grid lines. This reduces readability and looks bad, but it ensures the worst
case is still completely visible even when printed on paper.

Cue filling out these fields in iText. As expected the margins are off when
using setField and I'm going to have to manually figure out the right
setExtraMargin for every field. But what is also off is that vertically
alignment seems to have no effect (horizontal alignment, while having the
wrong margins, is still aligned to the right when specified in the
document). The result is that even the shortest text always top aligns, and
so is flush to the grid, making everything difficult to read/ugly.

In answer to your question for the OP, just like with the old margin
problem, when you click on the field it magically centers the text properly
(and if you edit the text it will even stay correctly aligned).

As I'm not familiar with the deep inner workings of PDF, so I don't know if
vertical alignment is an actual property for text fields, or if it's just a
trick done with margins (manually determining and saving a top margin that
will center the specific text string)

Is there a way I can work around or fixed this so that I can use an
arbitrary string with setField, and be sure that it will be wrapped and
centered correctly? If it helps, I am using iTextSharp, only need
compatiblity with Adobe 7/8 (Adobe 6 and its margins don't matter), and I
know which fields are vertically centered, so I could have special code just
for them.

Thanks if you can provide any wisdom


Mikael Andreasen wrote:
> However, when I add 
> data to the form using iTextSharp, the (vertical) alignment of multiline 
> text fields shows up wrong (top aligned) in the resulting document, 
> whichever viewer is used.

And when you click and change the field the alignment is correct again?
br,
Bruno


-- 
View this message in context: 
http://www.nabble.com/Vertical-alignment-of-multiline-form-fields-tp14197897p18638499.html
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to