Question 2:

You could use the FontMetric example in the book as a start to get a strings
width (depending on the font you are using).

If the width is wider than your area, just use a smaller font size.

Question 1:

AFAIK you can use the XfaForm class to get the XFA template from the PDF.


2007/6/21, Jim Cornmell <[EMAIL PROTECTED]>:


Hi Paolo,

> > I'm currently developing an application which uses iText to
> > merge text and graphics into a new PDF file.  I'm 90% there
> > and am impressed with how easy it has been so far, but I am
> > stuck with two points which I hope someone can answer:
> >
> > Question 1:  Within Adobe LiveCycle you can add a variable to
> > the form using the:  File | Form Properties | Variable tab.
> > So for example I've added a variable called "foo" with a
> > value of "bar".
> >
> >         How can I access the value of this variable within
> > iText.  I basically am using iText to merge bits of
> > information together (images and text) and using the template
> > to control how this is done.  I've tried using a form field
> > and this works fine but is a bit hacky and the variable
> > facility seems like a more elegant solution.
> >
>
> You'll have to parse the XFA XML yourself.

OK.  Any pointers to where in the iText API to go to extract the XML?

> > Question2: When replacing text into a form how can I detect
> > if the text fits, and thus if it does not reduce the font
> > size of the field until it does fit for example?
> >         I can easily setup various field in the form so I can
> > control the text to some extent, i.e. setup a field to force
> > the text to crop or wrap.  But if one of my users specifies a
> > text box and wants the text to shrink to fit.  I'm currently
> > assuming if I can find the size of the box (which I already
> > can with AcroFields:getFieldPositions() ) and then the string
> > width (which I cannot) then I can reduce the font size until
> > it fits using AcroFields:setFieldProperty().
> >
> > I guess for this I do not need to know the width of the
> > string I just need to know:  Is the field property set to
> > shrink to fit? and if so does the string fit?  If not reduce
> > the font little and try again.
> >
>
> If the field is auto-size why do you need to know the font size?

Again maybe I'm being dumb but I've tried various options in LiveCycle and
all I get is cropped text, it does not shrink.  The closest I've found is
the "Expand to fit" option in layout but my resultant PDF still looks the
same when I substitute the values in iText.

Jim



***********************************************************************************
This e-mail and attachments are intended for the above name only and may
be confidential. If they have come to you in error, you must take no action
based on them, nor must copy or show them to anyone; please reply to this
e-mail and report the error.
Security warning: Please note that this e-mail has been created in the
knowledge that the internet is not a one hundred percent secure
communication medium. We advise that you understand and observe this lack of
security when e-mailing us.
Virus: Although we have taken steps to ensure that this e-mail and
attachments are free from any virus, we advise that in keeping with good
practice the recipient should ensure they are actually virus free. If you
have received this e-mail in error please notify:
[EMAIL PROTECTED]


This message has been scanned for viruses by 
MailControl<http://www.mailcontrol.com/>,
a service from BlackSpider Technologies <http://www.blackspider.com/>.

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