9 Replies Latest reply on May 22, 2008 11:29 AM by (Rob_H_Abel)

    Have fdf ask for pdf

      Greetings,

      I'm stumped. I have a pdf form with an exportAsFDF script. Now, I know that the right way to do this is to send the fdf to a server for processing but I do not have the resources to do that at this time.

      Here's what I'm hopping for: have the fdf ask for the pdf when opened. Right now the fdf tried to go back to the website (if posted there) or the users computer (if saved locally). For testing, I opened the fdf with a text editor, deleted the UF and /F file paths and saved the file. When I opened the fdf again, it asked me to point it to the pdf.

      It's not ideal but I can deal with the fdf asking for the pdf. Is it possible to not include a file path on an exported fdf through acrobat scripting?

      Thanks,
      rob
        • 1. Re: Have fdf ask for pdf
          Patrick Leckey Level 3
          You cannot with the exportAsFDF() method.

          You could use the exportAsFDFStr() method, the cHRef parameter can specify the /F tag (set it to null or ""). You then have the added complication of creating an empty data object, setting the data object contents to that of your FDF string, exporting that data object in order to save the FDF data you get in exportAsFDFStr() and then removing the data object.
          • 2. Re: Have fdf ask for pdf
            Level 1
            Hello PDL,

            Thanks for the quick response. OK, so would it be:

            this.exportAsFDFStr({cHRef""});

            Correct? I tried it and got no results.

            What am I doing wrong?

            thx,
            Rob
            • 3. Re: Have fdf ask for pdf
              Patrick Leckey Level 3
              Did you read the documentation about the exportAsFDFStr() method, or even the rest of my above post? I mentioned that using that method would require a lot more work to get it to function the way you want:

              > You then have the added complication of creating an empty data object, setting the data object contents to that of your FDF string, exporting that data object in order to save the FDF data you get in exportAsFDFStr() and then removing the data object.

              If you read the documentation about the exportAsFDFStr() method, it says:

              > Computes the same results as calling the doc.exportAsXFDF method, but returns the results as a string instead of saving to a file.

              Which is why I listed all those above steps in order to save to a file.

              Also, I assume it's a typo but just incase, when creating a parameter object for a JavaScript function you need to put a colon between the parameter name and the value, example:

              this.exportAsFDFStr({cHRef: ""});
              • 4. Re: Have fdf ask for pdf
                Level 1
                Hello PDL,

                I'm sorry, I didn't understand your original reply, but now I do. So, are the other steps necessary something that can be done through acrobat scripting?

                Thanks,
                Rob
                • 5. Re: Have fdf ask for pdf
                  Patrick Leckey Level 3
                  Yes, you can perform those steps in Acrobat JavaScript.
                  • 6. Re: Have fdf ask for pdf
                    Level 1
                    That's great news! OK so, per your previous posts I need to:

                    1. exportAsFDFStr
                    2. Create an empty data object.
                    3. Set the data object contents to that of the fdf string.
                    4. Save the fdf data from the string.
                    5. Remove the created data object.

                    Correct? Any chance of you posting a sample script for me to work off of?

                    Thanks for your help, I really appreciate it.
                    rob
                    • 7. Re: Have fdf ask for pdf
                      Patrick Leckey Level 3
                      This oughta do it:

                      var cFDFData = this.exportAsFDFStr({
                      cHRef: ""
                      });

                      var oData = this.createDataObject({
                      cName: "my.fdf",
                      cValue: cFDFData,
                      cMIMEType: "application/vnd.fdf"
                      });

                      this.exportDataObject({
                      cName: "my.fdf",
                      nLaunch: 0
                      });

                      this.removeDataObject({
                      cName: "my.fdf"
                      });
                      • 8. Re: Have fdf ask for pdf
                        Level 1
                        You sir, are a gentleman and a scholar! Works like a champ!

                        Thank you very much!
                        Rob
                        • 9. Re: Have fdf ask for pdf
                          Level 1
                          Hello PDL,

                          I spoke too soon; this one's weird. If a text box that has a default value (say one blank space) is filled in with letters and the default value is not deleted the fdf the script creates becomes corrupted.

                          The file does not corrupt if the box is filled with numbers or if you add the default field value to the end of your entry.

                          So if field 1 has a default value of (space)-

                          ABC = good
                          (space)ABC = corrupted
                          (space)ABC(space) = good
                          ABC(space) = corrupted
                          ABC(space)(space) = good
                          (space)ABC(space)ABC = corrupted
                          (space)ABC(space)ABC(space) = good.

                          Any ideas?

                          thx,
                          Rob