Accomplish any objective with DocHub features for document management and convenient PDF editing. I just this morning put this same information into my blog at comprehensive control of your papers at any time is important to relieve your everyday tasks and increase your productivity. You need to be sure your PDF form is the correct type of form for your workflow. As I start off saying in my PDF classes, a PDF form is not a PDF form, there are different types of PDF forms. Livecycle Designer offers much more flexibility when working with PDF forms, and is a program that many do not even know exists. It is now a separate license but does have a trial version available like all the other Adobe products. Users of Acrobat XI do not get LIveCycle Designer installed with the Acrobat installation. When you Acrobat versions 7-9 or X, you get LiveCycle Designer installed in the same installation. If you want to use ColdFusion to work with the form and data, you must create the form in LiveCycle Designer, or open the Acrobat form in LiveCycle Designer and modify it to suit your needs as XML.ĬoldFusion could not access the Acrobat form bit data, which I think is why no error or exception was thrown. LiveCycle Designer creates PDF forms that are stored as XML. Just to clarify, Adobe Acrobat creates PDF forms that are stored as bit data. Note that normally I'd use a dynamic name for the PDF as the code right now would not work with multiple users. I can't share the original PDF, but hopefully it gives you an idea of how such an app could be built. Hope this helps! Here is the complete POC I built. Again - I had to use my original form quite a bit here to see what values were being persisted when I entered data. The no value was only true when the value was No and yes was only true when the value was yes. I assumed there would be two fields for this representing each checkbox. Another field on the form had something like this: "Is Ray Cool No Yes". To make it even more interesting, not all checkboxes act the same. I then saved it, reran my "get the fields and dump them" script, and I saw that when I checked a checkbox, the value was On. So then I went back to my original PDF form and did the obvious - I checked the checkbox. I tried setting them by using true, 1, and "checked" as values, but nothing worked. For text fields, you could easily set them by just supplying a value: I ended up using this script as a guide for building my code that would then set the fields. Some fields did have obvious names but many did not. This is important because you probably can't guess them just by looking. Now that my script worked, I could use the struct as a way of seeing the names of the form fields. I still think ColdFusion should be able to sniff that form type and throw an exception (one that is helpful), but, now you know, and knowing is you know what. Luckily the client had a newer form of the PDF and as soon as I changed to that, it worked. Third-party PDF form creation tools generally create AcroForms rather than LC forms, but there may be third-party tools available that create LC forms that I don't know about. Forms created directly in Acrobat are not LC forms - they're generally called "AcroForms". LC forms are basically a PDF container for an XFA payload - the form itself is represented as an XML document conforming to the XFA schema. LiveCycle forms are created using LiveCycle Designer, which ships with Acrobat Pro (and is available separately). He went on to say: It has to be a LiveCycle form. I needed a PDF using the newer style called a LiveCycle form. All around smart guy Dave Watts suggested that the PDF I had was probably using an older style of form called "AcroForm". At this point I had no idea what to do so I asked around. But if I tried to parse the XML variable (X), I got an error stating the XML was invalid. On a whim I got rid of the result attribute. When I ran it I got: Either datafile XML or data XML contained in the PDF document is invalid. The code above should have retrieved the form data as both a struct and XML. But in ColdFusion something odd happened when I tried to get data out of it. The first thing I ran into was that the initial PDF was not compliant with ColdFusion's PDF form handling. For the most part the process was painless, but there were a few gotchas I wanted to share with folks. This user needed the input to be passed to the PDF and saved there. A client needed me to build a simple POC that used an HTML form to accept user input. ColdFusion has had the ability to work with PDF forms for a while, but I never got a chance to actually play with it till last night.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |