13 Replies Latest reply on May 12, 2009 8:17 PM by Kevin Cavallo

    Create Static PDF after Initialize script

    Ryan Lunka Level 3

      I have a workflow that merges an XDP (built mostly of fragments) and form data.  At the end of the process I need to append some static PDF files to the end.  Because Assembler will not allow assembly of a dynamic XFA form, I am trying to use Output to flatten it first.  The problem is, there is script in the Initialize event of the form that rearranges some things based on a status value in the form data.  When I run the form through output, it is flattened before this happens.


      Does anyone have an idea of how to go about this?  We've been playing with PDF/A's and FormsService and can't get anywhere.

       

      Thank you!

        • 1. Re: Create Static PDF after Initialize script
          Kevin Cavallo Level 4

          I'm not sure why this is a problem for you.  We regularly render XDPs with merge data via Output, including generating dynamic layout.  All of the events fire and the fields are not flattened first.  Are you allowing your scripts to run on the server, or are they marked client only?  What are your render options in Output?

          • 2. Re: Create Static PDF after Initialize script
            MarcelBoucher Adobe Employee

            Ryan,

            Are there multiple XFA documents in the package your are trying to generate? I ask this because if you only have one XFA form and all the other content is flat PDF, then you can assemble these files. What you need to do in this case is set the XFA document as the baseDocument as documented in the DDX command reference.

            • 3. Re: Create Static PDF after Initialize script
              Ryan Lunka Level 3

              Hey guys, thanks for the quick response.  I am confused about this too, because I thought this was supposed to work.

               

              The scripts that I have that fire on initialize are set to run at "Client and Server".  Our Output looks like this:

                    

                   Transformation Format: PDF

                   PDF Version: Auto

                   Acrobat Version: Auto

                   Tagged PDF: False

                   Linearized PDF: False

                   Render at Client: No (Auto also did not work)

                   Retain Signature Field: (blank)

                   Debug Enabled: False

               

              No, we are not trying to package multiple XFA forms.  The first one is an XFA and then the subsequent 2+ forms are just flat PDFs (created with PDF Generator).  I know the XFA is supposed to be the baseDocument.  I don't explicitly force that in the DDX, because it's the first document on the list.  I thought that would default it to the baseDocument.  Is that incorrect?

               

              Ryan D. Lunka

              Adobe Enterprise Solutions Consultant

              Cardinal Solutions Group - Columbus, OH

              • 4. Re: Create Static PDF after Initialize script
                Kevin Cavallo Level 4

                As far as I can tell, everything looks and sounds OK.  Can we break this up into pieces?  How do you know that the form is flattening first?  Can you tell from the logs?  If I understand your process, this is an Output issue, not an Assembler issue, correct? 

                • 5. Re: Create Static PDF after Initialize script
                  Ryan Lunka Level 3

                  Yes.  I think it is an Output issue.  I know the form is flattening because when the process finishes, I have my flattened form and the subsequent PDFs tacked onto the end.  Everything appears to have worked.

                   

                  BUT, when you look at the first form (the main one that starts out dynamic), the form is in the original state it would be had none of the initialize script actually completed. 

                   

                  I only mentioned that there was the possibility of an Assembler issue because one of my attempted/failed solutions was to use the FormsService to render the PDF and send that into Assembler.  Assembler didn't like the dynamic XFA form.  I'm thinking the way to go, though is Output.  I'm currently going through and changing EVERY script in all my fragments to run at "Client and Server" instead of just the ones that are supposed to run on initialize.  Maybe I missed one and that's why it isn't working, but something tells me that's not the issue.

                   

                  Long story short, I just need to get those initialize scripts to run before Output flattens it.

                   

                  Ryan D. Lunka

                  Adobe Enterprise Solutions Consultant

                  Cardinal Solutions Group - Columbus, OH

                  • 6. Re: Create Static PDF after Initialize script
                    Kevin Cavallo Level 4

                    Your scheme is the same that we use; run our .xdps through Output and then assemble them.

                     

                    Can you put together a simple first form to test with, having a simplified structure and an initialize script similar to what you are doing in the real form?  There must be something basic wrong, because this all works OK for me.  If your simple form still fails maybe you can post it for us to take a look.

                    • 7. Re: Create Static PDF after Initialize script
                      Kevin Cavallo Level 4

                      Also, do you have any errors in the adobe logs on the server?

                      • 8. Re: Create Static PDF after Initialize script
                        Ryan Lunka Level 3

                        Ok here's the update so far...

                         

                        I did create a simple XDP to run through the same process and the initialize scripts ran as expected.  So that means the problem is the form.

                         

                        I watched the logs and saw this...

                         

                        May 12, 2009 5:04:45 PM EDT> <Warning> <com.adobe.formServer.Template> <servername> <application> <[ACTIVE] ExecuteThread: '16' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <BEA1-5E413F5896790D39C5B0> <> <1242162285797> <BEA-000000> <ALC-OUT-002-515: Incompatible Form model: Form may render incorrectly. Form /COMeT/Forms/MasterForm.xdp has some server side scripts which may not be executed as FormModel is set to Client.

                         

                        Following this, you can see where all of the initialize scripts try to run but it says they fail.

                         

                        Then there is an error that comes up like a hundred times, right in a row...but it might be a completely different issue:

                         

                        java.net.UnknownHostException: usadc-vzwlsd23

                         

                        Any more ideas?  Thank you for the help.

                         

                        Ryan D. Lunka

                        Cardinal Solutions Group

                        rlunka@cardinalsolutions.com

                        • 9. Re: Create Static PDF after Initialize script
                          Kevin Cavallo Level 4

                          Ahhh, OK.  I have a clue, but I'm also confused.

                           

                          In FormsService there's a render option named FormModel. Here's what the Adobe docs say about it:

                           

                          Form Model: Sets the type of scripts embedded in the form that are to be executed. The following values are valid and the default is Auto.

                          Auto: The Forms service checks the form to determine where the form design is to be rendered.

                          Both: The form is rendered on both the server and the client.

                          Client: The form is rendered on the client. If there are scripts in the form design that are run on the server or on both the server and client, a warning is generated on LiveCycle ES.

                          Server: The form is rendered on the server.

                           

                          Essentially if you have it set to Client, it will ignore any scripts that are tagged to run on the server.  Set it to auto to fix your issue.

                           

                          What's confusing me is that you said you were rendering using Output.  I can't find any reference to Output having this option. It only exists in FormService.  Are you sure you're going through Output?

                          • 10. Re: Create Static PDF after Initialize script
                            Ryan Lunka Level 3

                            I'm positive it's Output.  I've attached a screenshot of the settings.  I can see in the log file where the scripts in the form are attempting to run.  I think it's something in the form, but I can't figure out what.

                            • 11. Re: Create Static PDF after Initialize script
                              Kevin Cavallo Level 4

                              Well, I hate brute force, but if your form is a bunch of fragments, make a copy of it and start pulling out fragments one by one and see when (or if) it starts working.  That error that you see in the log troubles me, since it is a FormService error and the behavior that you're seeing exactly matches the error that you're getting.

                              • 12. Re: Create Static PDF after Initialize script
                                Ryan Lunka Level 3

                                Unfortunately the fragments are pretty interdependent, so if I take them out, things will start breaking.  That error I posted earlier I was able to get rid of.  There was a tag in the XFA form that I changed manually and I think that did it.  Now I still get a bunch of script errors, but those are essentially what the JavaScript debugger would show.  The form works despite those coming up in the JavaScript debugger.  I know why they exist and know that they are irrelevant.

                                 

                                I'm seriously stumped with this one.  I don't understand what about the form won't allow the scripts to run.

                                 

                                I was thinking, I'm going to try to figure out the very first script that should run (probably initialize for the top level node), and put an obnoxiously simple script there (like make the background blue or something).  That way I can see if ANY script is running.  That'll tell if there is no script at all or the script is starting and breaking somewhere.

                                 

                                Any more ideas?

                                • 13. Re: Create Static PDF after Initialize script
                                  Kevin Cavallo Level 4

                                  Without seeing the form I'm running out of ideas.  A few things:

                                   

                                  Scripts are executed from the innermost level out, so your top level node will be the last to fire.  Try the scripts deep inside the hierarchy.

                                   

                                  One of my issues with Output is that the javascript implementation is less complete on the server than it is in Reader & Acrobat.  I've had to rewrite javascript that works perfectly well when tested in Designer because it failed in Output.  Some of the problem areas I've encountered include regular expressions, Date() handling, and the util object methods.  Most of that stuff should cause javascript errors in the log files, but who knows.  I've found that errors in script fragments show up in the logs as problems in the calling event.

                                   

                                  How about wrapping your scripts in try/catch blocks and displaying the resulting exception info in a text field somewhere.  If the events are firing you'll get some feedback.