Stefan Cameron on Forms
Building intelligent forms using Adobe LiveCycle Designer

Previewing as Dynamic PDF

Have you ever lived through the frustration of previewing a form on which you’ve written a simple little script to affect the presence of an object when a button is clicked and pulling your hair out because you keep clicking on the button and nothing happens (object doesn’t disappear, there’s no error message, etc.)? Or maybe you’ve been in a situation where you’ve added script to a button in order to insert a new instance of a repeatable subform and while clicking on the button doesn’t produce one, the submitted XML data file contains entries for each new instance that was added?

Even if you haven’t, it may happen someday so here’s the remedy for the case of the “Common (Static PDF) Flue”…

In Designer, there are two different locations containing settings which affect the type of temporary PDF file created when you click on the Preview tab:

  1. Under the “File Options” section within the “Document Handling” panel of the “Tools | Options” dialog, you can set the Default File Type for New Forms. This type is used on new forms which you preview prior to saving (because Designer doesn’t know which format you’ll use at the time of preview). This is set to a static PDF format by default.
  2. Even if you’ve specified a dynamic PDF format for the Default File Type for New Forms, this setting may be overridden by the Preview Type and XDP Preview Format properties in the “File | Form Properties” dialog in the “Defaults” panel once you’ve saved your form. The Preview Type property, set to “Interactive” by default, determines whether the form will be previewed as an interactive (dynamic) form or as a print (static) form. This property supersedes the PDF format. The XDP Preview Format property usually picks-up the Default File Type for New Forms setting and determines what PDF format will be used to preview your form should it be saved as an XDP. (Note that if you’ve saved your form as a PDF file, then the XDP Preview Format setting is ignored).

Now that we’ve covered the different properties which affect the PDF preview format, here’s how to kick that flue I was talking about earlier (so that you actually do preview in a dynamic PDF format and stop pulling your hair out):

  1. If you haven’t saved your form, make sure the Preview Type is set to “Interactive” and that the Default File Type for New Forms is set to a dynamic PDF format. You may also want to set the XDP Preview Format to a dynamic PDF format while you’re at it.
  2. If you’ve saved your form as a dynamic PDF, make sure the Preview Type is set to “Interactive”.
  3. If you’ve saved your form as a static PDF, none of these settings will help you. You must first save your form as a dynamic PDF.
  4. If you’ve saved your form as an XDP, make sure the Preview Type is set to “Interactive” and the XDP Preview Format is set to a dynamic PDF format.
  5. If you’re tired of running into these problems and want to avoid them in the future, just set your Default File Type for New Forms to a dynamic PDF format.

I hope this tip improves your form design health. It did wonders for me!

Updated: January 27, 2007


Posted by Stefan Cameron on July 24th, 2006
Filed under Debugging,Designer,Scripting
Both comments and pings are currently closed.

31 Responses to “Previewing as Dynamic PDF”

  1. cd on September 7th, 2006

    Blessings on you & yours, Stefan! I’m starting to feel better already.

  2. Ram Mohan Boddula on September 24th, 2006

    Does this help in client side database lookup while working with Adobe Reader? I have a template that pulls data from a client database. Currently I am unable to preview my template in Reader as I am receiving “Array Index Out of Bounds” error. I am able to preview this pdf on machine with Acrobat Professional as the default for viewing PDFs.

    Doesn’t client side lookups work with Reader (before putting any special privileges into the document) from with in the Designer?

    Do I have to have “Acrobat Professional” during the development of forms that do client side database lookup?

    Appreciate your help.

  3. Stefan Cameron on September 26th, 2006

    Ram,

    This article won’t help you out with client-side database look-ups.

    In short, you need Acrobat Standard or Pro to import data into forms regardless of proximity.

    I think my article on importing data in Acrobat might answer a few of your questions in this regard.

  4. andrea on May 14th, 2007

    Hi Stefan,

    I’ve just installed Designer 8.0 trial version and have difficulties getting the “Print Button” to work. It workes fine for me with Designer 7.0.
    I’ve created a form using the form assistant with only the generated “Submit by Email” and “Print Form” buttons on it. I’ve set all the previewing options to dynamic PDF (Acrobat 8 ) as you described in this article. The “Submit by Email” button is working, but the “Print button” does nothing. I’ve put a console.println statement before and after the generated call “xfa.host.print(1, “0”, (xfa.host.numPages -1).toString(), 0, 1, 0, 0, 0);”. They came out fine, but the print dialog doesn’t appear.

    Any ideas? What am I missing?

    Thank you for help,
    Andrea

  5. Stefan Cameron on May 16th, 2007

    Andrea,

    I can’t think of what’s going wrong based on what you described. I tried it myself using Designer 8.0 and both Acrobat Pro and Reader 8.0 and couldn’t replicate the problem.

    Is there anything in the JavaScript Console (like an error message of some sort) after you click on the print button?

  6. andrea on May 18th, 2007

    Hi Stefan,

    there are no error messages in the JavaScript Console. It just shows the following output:

    ————————– output beginning —————————————————-
    Acrobat JavaScript Debugger Functions Version 7.0
    Acrobat Database Connectivity Built-in Functions Version 8.0
    Acrobat EScript Built-in Functions Version 8.0
    Acrobat Annotations / Collaboration Built-in Functions Version 8.0
    Acrobat Annotations / Collaboration Built-in Wizard Functions Version 8.0
    Acrobat Multimedia Version 8.0
    Acrobat SOAP 8.0
    before print numPages=1
    after print
    —————————- end of output —————————————————–

    My script looks like this:

    —– form1.#subform[0].PrintButton1::click: – (JavaScript, client) ——————————–
    console.println(“before print numPages=” + xfa.host.numPages);
    xfa.host.print(1, “0”, (xfa.host.numPages -1).toString(), 0, 1, 0, 0, 0);
    console.println(“after print”);
    ————————– end of script ————————————————————-

    I’ve even tried to call “xfa.host.print()” without any parameters to see if the print method gets called.
    Then I get the expected error message saying “…wrong number of parameters…”.
    So it looks like the print message gets called, but just does nothing.

    Maybe it has something to do with using Acrobat JavaScript Debugger Functions Version 7.0 and not Version 8.0?

  7. andrea on May 18th, 2007

    Stefan,

    I’ve just tried to open my test form with Acrobat Reader 7.0 and the Print Button works fine!
    What does that mean?
    It is neither working with Acrobat Professional 8 nor with Designer 8.0.

  8. Stefan Cameron on May 18th, 2007

    Andrea,

    That’s really strange. I can’t see any reason for your print script (which is pre-defined by using the “print button” object) to fail — and without any error messages, for that matter.

    The only thing I can think of that could be happening is that the Acrobat (the host) print dialog is opening behind the Designer (when previewing the form) or Acrobat (when running the form separately) window for the 8.0 product versions and you simply aren’t noticing that it’s open and waiting for your command. If you have multiple monitors, it may also be appearing on the second monitor or even off-screen depending on your setup (if it was last displayed on the second monitor and now you’re using your system with a single monitor).

    The “xfa.host.print” command isn’t a blocking command which means that when you click on the print button, you’ll get both the “before” and “after” console outputs you specified immediately, as the Acrobat print dialog is opening.

  9. andrea on May 26th, 2007

    I’ve checked to open the print dialog in Acrobat using “File” menu “Print…”. When the print dialog opens this way, it pops up in front of the main Acrobat window and blocks any other input (as it’s supposed to be).
    After clicking the Print button in Acrobat, the print dialog doesn’t pop up and is not opening behind the Acrobat window. I’m only working with one monitor.
    I’ve also tried to set the first parameter of the xfa.host.print method to false (no print dialog), but nothing happens.

    I think there must be something wrong with the installation of Acrobat Professional 8 or Designer 8 trial version. I’m awaiting the main version of Acrobat Professional 8 within the next view days and will go from there.

    If you have any other ideas what’s wrong with my print dialog, I would appreciate your comments.

    Thanks for your help!

  10. Stefan Cameron on May 29th, 2007

    Andrea,

    Unfortunately, I’m all out of suggestions. Hopefully installing the full versions of Acrobat Pro 8.0 and Designer 8.0 will solve the problem.

  11. Alan on July 28th, 2007

    Andrea,

    Did you manage to solve the issue with the print function not working? I am running the main version and am having the exact problem that you describe.

    Thanks in advance,
    Alan

  12. Tim on October 15th, 2008

    Hello,

    I am having problems with the PDF preview and the design view of LC 8. I have the full version installed along with profesional 8 and reader 8 (all in a package).

    I have previously created a form from a template and then switched through to the pdf view and filled out a few fields then switched back to design view edited and then again switched back to pdf view and information I previously put in the pdf view fields remains there. Great! however this time I come to use it I can not for the life of me keep the information remaining in the pdf view when I switch back and forth between the pdf view and the design view. Every time I fill in the pdf view to test it, switch back to design then back to pdf all the info has disappeared. Why? I have uninstalled and re installed and no joy! anything I need to tick or untick or change in settings? It’s driving me mad as I carnt edit or save the pdf form as it’s always blank. I have added pictures and rearranged the form to suit my application and they all stay and save fine. It’s when I actually have to input data on the pdf preview that it disappears when I return from the design view.

    I have also tried opening a completly unchanged template such as an invoice. Straight away I go to pdf view and fill in a couple of fields. then switch back to design, then straight back to pdf view and it’s the same, all the info I just inputed has disappeared.

    Can someone help?

    Thanks in advance

    Tim

  13. Stefan Cameron on October 19th, 2008

    Tim,

    I hate to say this because you’ve already been through so much trying to fix this but the data you enter into the PDF in the PDF Preview tab will not be retained when you switch back to Design View. The PDF you see in the Preview tab is just a temporary file generated on-the-fly from the current state of your form in Design View. I can’t explain why it initially “worked” for you but this is the way it is.

    Note that Designer 8.1+ can generate preview data for you do you don’t have to keep re-typing it to test your form every time you preview it. Just go to “File menu > Form Properties > Preview tab” and click on the “Generate Preview Data…” button.

  14. Tim on October 20th, 2008

    Great thank you Cameron, thats saved me going bonkers trying to work out a solution. I’ll have a look into ver. 8.1 as well.

    Thank you very much once again.

    Tim

  15. Daniel on November 12th, 2008

    Hi Stefan,

    i have two problems using Livecycle Forms. I don’t know if it’s the right category for my questions but i hope you could help.

    I have done a xdp file and a java servlet which calls to LC Forms. Forms render this xdp and send me a pdf which I can save and work with it. But, if I add some images, fields or someone else to my xdp file, LC Forms send me a pdf file with this error (it’s a traslate, it can be wrong) “The file does not begin with PDF”.

    I have tested my xdp and I think this problem can be because there is a limit on xdp’s size. Actually my xdp is 774Kb. If I add a text in it, for example, its size is 775Kb and i have that error from LC Forms. Is there any restriction about size in a xdp? Any idea about this error?

    And another and simple question is, when LC Forms sends me a pdf without errors, this pdf is a static form. How can I get a dynamic pdf? Do i have to use LC ReaderExtensions, for example?

    thanks in advance.

    Daniel

  16. Daniel on November 13th, 2008

    Hi Stefan,

    I have resolved my first error. i was right thinking it was an error about xdp size. LC has a Default document max inline size of 64KB. It can be changed in LiveCycle AdminUI, Settings->Core System Settings->Configurations and set a value of 1MB, for example (with this new value I haven’t any errors)

    i still have the second error. My pdf is a static form, how can i get it like dynamic form?

    Thank you in advance. Regards

    Daniel

  17. Stefan Cameron on November 18th, 2008

    Daniel,

    I’m not aware of a size limit on XDP forms.

    As for getting a dynamic PDF from LC Forms, you should be able to control that by setting the “File > Form Properties > Defaults tab > Server section > PDF Render Format property” to “Dynamic XML Form” (in Designer 8.2 — you’ll find something similar, related to server-side rendering, in previous versions of Designer as well).

  18. Aldo on March 12th, 2009

    Thanks Stefan… I was about to kill myself.

  19. Mark on July 24th, 2009

    I cannot preview a form in LiveCycle Designer 8. I tried your steps above and it did not work. Any other suggestions?

    Thanks,

    Mark

  20. Stefan Cameron on July 29th, 2009

    Mark,

    Do you have Acrobat and/or Reader installed on your computer? What’s the behaviour, in Designer, that leads you to believe you cannot preview a form?

  21. Joe on August 5th, 2009

    Hi Stefan,

    I cannot preview a form in Designer 8.2. I have Acrobat 9.0 and reader 9.1 installed. I checked both of their internet settings and they are checked. I had it this morning when I was updating an old form, now it’s greyed out in the menu, and missing from the window. Any suggestions?

    Joe

  22. Stefan Cameron on August 14th, 2009

    Joe,

    It sounds like Designer isn’t recognizing that you have either Acrobat or Reader installed. I would try re-installing one of them to see if it re-enables the PDF Preview tab.

  23. Geno on August 19th, 2009

    Stefan – you are a champion. I spent a whole day figuring out why I couldn’t get your Expandable Table example to work. I was going nuts pulling my hair out until I found this.

  24. Stefan Cameron on August 23rd, 2009

    Geno,

    Isn’t this a killer? Even after writing this post, I still get caught sometimes! Glad it helped.

  25. Sam - Urgent on April 29th, 2010

    I created a dynamic form in lifecycle 9 and my client has 8.0 and some of the dynamic features with radio buttons and dropdown fields which do not work now since I added a Add and Delete buttons for adding additional forms. They use to work before…..When I use it in Adobe 9 Reader it works everything works. Help………

  26. Stefan Cameron on May 1st, 2010

    @Sam – Urgent,

    It’s quite possible that Reader 9.0 has some bug fixes to radio button/exclusion group/drop down list behaviour that Reader 8.0 doesn’t.

    To make sure Reader 9.0 behaves like Reader 8.0 when it loads your form, you can target your form to Reader 8.0 by setting the “File > Form Properties > Defaults tab > Target Version property”.

  27. Lucien on June 30th, 2010

    Incredible story, a 100% fit, thanks for sharing and ending my horrible pain.

  28. Jesus on October 5th, 2010

    In Adobe LiveCycle and PDF Preview how do I make the sunken box not overlap with the sunken box thats on the buttom of it, its right after I added a lot of text it stretches down the sunken box and overlaps with the other one at the buttom.

  29. Stefan Cameron on October 18th, 2010

    @Jesus,

    This may be related to how borders are rendered. You should have a look at the article I referenced here. It may clear-up a few things.

  30. Craig Lambson on November 17th, 2010

    I am using LiveCycle and Adobe Professional V9.2. I have several one page documents (about 20), each of which will contain a text box at the bottom of the page for additional text/comments. These boxes must flow and paginate to include an unlimited amount of captured text. I have wrestled with subforms, and wrapping, flowing, and formatting, all to no avail. I still cannot get the text to paginate to another page. Can I send you the page and you can show me how to do it and then I can fix the rest of them? There is no on in my company who can help me…..or send me to a good tutorial or example.

    its a straightforward problem. I just cant get the steps in the right order.

    thx,
    Craig Lambson
    craig.lambson@gmail.com
    clambson@westech-inc.com

  31. Stefan Cameron on November 24th, 2010

    @Craig Lambson,

    The key to making the text fields grow to accommodate text is to:

    1. Make them multiline (Object palette > Field tab > Allow multiline property).

    2. Make them expandable in height (see “Making a Field Expandable” here).

    3. Put them in a flowed subform (that is, a subform whose “Object palette > Subform tab > Content property” is set to “Flowed”) that allows page breaks within its content (via the “Object palette > Subform tab > Allow Page Breaks within Content property”).

    4. Allow their contents to break across pages (Object palette > Field tab > Allow Page Breaks within Content property).

    Note that all subforms that ultimately contain the text fields (i.e. all subform containers up to the root subform which are parents of the text fields) must be flowed and must allow page breaks within their content.

    I also address an issue with content that gets cut-off at the bottom of a page in my MAX 2007 Tutorial by placing the content directly inside the root subform which is flowed by definition.