These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Inline Variables Defined at Runtime

nautis
Registered: Mar 20 2009
Posts: 6
Answered

I have a question about defining inline variables. We are currently using overlays to print data on top of pre-defined templates. We have a tool (Tall Components) that populates the documents with data at run-time.

In Acrobat forms, it seems I am required to select a predefined area (height x width) for a variable field. Most of the forms we print are narrative legal documents they do not look like normal forms. What I would like to do is like mail merge in Word. Here is an example:

Quote:

Hello $FirstName $MiddleInitial $LastName. The date today is $todaydate.

These variables will be used throughout the document but we don't want to define the field lengths because names can vary wildly in length (for example) and that would create a lot of wasted space for people with very short names. So, my question is ... is this possible in Acrobat?

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Is it possible? yes and no. Acrobat cannot reflow content text, i.e., static text on the page, that was created from another document type being converted into a PDF. It seems you've already experimented with using form fields to overwrite the individual words and found this unsatisfactory.

So there are two approaches. The first one is to regenerate the PDF with new content using custom solution built from a 3rd party tool, like iText, ColdFusion, or any of the other PDF creation libraries/tools. I think this is what most people do.

But there is another easier possibility. Acrobat can reflow text in a multiline Text Field. Or if you use a Dynamic LiveCycle form, you can get even better reflow. Place a large text field over the area of the form (a complete paragraph) where specific strings need to be replaced. Then in code(an automation script), replace the text in the paragraph and write it into the text field. When the text replacement is complete, print the form to the PDFMaker to flatten it all out.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

nautis
Registered: Mar 20 2009
Posts: 6
Thom -

Thank you for your response. I was hoping this was possible. I'll check out your website. Looks like a great resource. I will report back to forum with our results.
CMSULLI
Registered: Mar 23 2009
Posts: 4
I am new to this - how can I create a "macro" that will export data from a form as a txt file to be used in Wordperfect?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
CMSULLI - please post new questions to a new thread.

The only way to create a Macro in Acrobat is to write a folder level script that places a button on the toolbar. Unfortunately this is not as easy as it should be. You can find more information by searching the forums and tutorials for "JavaScript Toolbar button".

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script