11 Replies Latest reply: Oct 23, 2006 10:14 AM by (scott_jiang) RSS

    capturing the attributes of PDF elements

      hi,
      i want to capture the attributes of each object of a PDF documents.Can anyone guide me which document i have to follow or any sample which can help me?
      Ashwini
        • 1. Re: capturing the attributes of PDF elements
          HowardTreisman CommunityMVP
          Hi Ashwini

          This is a very broad question. Could you try to be more specific please.
          Howard
          • 2. Re: capturing the attributes of PDF elements
            Hi Howard,

            I guess I have a similar(maybe different) situation:

            I have a form-type process variable FM_1 defined for the workflow WF_1.
            In the custom QPAC I created, I want to access this instance of form(FM_1) associated with WF_1. I'd like to find out the FM_1's structure(field names, data types and corresponding values).

            Can I get this via PATExecutionContext?

            Thanks,
            Scott Jiang
            Compuware Corp.
            • 3. Re: capturing the attributes of PDF elements
              Community Member
              Try: PATExecutionContext.getProcessDataValue("/process_data/FM_1");

              Off the top of my head I believe the returned object is of type com.adobe.workflow.task.FormInstance.

              Chris
              Adobe Enterprise Developer Support
              • 4. Re: capturing the attributes of PDF elements
                HowardTreisman CommunityMVP
                Hi
                Wot Chris sed.
                Except the returned object type is: com.adobe.workflow.datatype.form.FormDataTypeInstanceImpl

                You can call getXFAData() on this object to get the underlying XML for the form. This in turn should allow you to get at the element names and values. It will not tell you the datatypes - these would be determined by your forms xml schema.

                Howard
                http://www.avoka.com
                • 5. Re: capturing the attributes of PDF elements
                  Community Member
                  Thank you both.

                  Howard, now I can get this com.adobe.workflow.datatype.form.FormDataTypeInstanceImpl class from adobe-wfk.jar(contained inside LiveCycle.ear). I have further question on this(because I don't think this class is documented anywhere):

                  FormDataTypeInstanceImpl.getXFAData() returns a byte[], I can see the runtime form-type structure/value in a xml-like structure using toString() printout. This is exactly what I need. From this point, can you enlighten me on which package I should use to interpret this byte[] array? Any special utility class/method in the SDK can help? Or, I need to write code using DOM/SAX API to traverse the xml tree? Please advise.

                  Best regards,
                  Scott Jiang
                  Compuware Corp.
                  • 6. Re: capturing the attributes of PDF elements
                    HowardTreisman CommunityMVP
                    Hi Scott
                    Once you've got your XML, there are lots of ways you can process it. Usually this mean processing the text using some sort of XML library, such a DOM, JDOM, DOM4J, etc.

                    Adobe have some static methods in a class called DOMUtils (or DOMUtil, I can't remember) that has a few simple utility methods, but basically, it ends up with a DOM tree that you can traverse. This is also undocumented, but the methods are fairly self-explanatory.

                    Regards,
                    Howard
                    http://www.avoka.com
                    • 7. Re: capturing the attributes of PDF elements
                      Community Member
                      Hi Howard,

                      Sounds fair. Further question:

                      After I processed some of the node values in xml document, I have to pass in the ***whole updated xml content*** by calling public setXFAData(byte[] xfaData), right? This is the only one I found seems can set value back to workflow.

                      Is there better way to do it in Workflow SDK? I am afraid this is going to impact the performance. Please advise.

                      Best regards,
                      Scott Jiang
                      Compuware Corp.
                      • 8. Re: capturing the attributes of PDF elements
                        Community Member
                        This is a little weird: I now processed the xml document but setXFAData() doesn't work. I still see the old values from form-type process variable. How can find out what's wrong? There is no error...

                        FormDataTypeInstanceImpl.setXFAData(xmlDoc.toString().getBytes());

                        Scott
                        • 9. Re: capturing the attributes of PDF elements
                          Community Member
                          Never mind. I should use javax.xml.transform.Transformer to convert xml document to String then to byte[]. Now it works.

                          transformer.transform(source, output);
                          FormDataTypeInstanceImpl.setXFAData(baos.toString().getBytes());

                          thank you,
                          Scott
                          • 10. Re: capturing the attributes of PDF elements
                            Community Member
                            Hi Howard,

                            Do you know the default field length output parameter(for String type)?

                            I tested my customer QPAC which can take input sql string and set output parameter with a string of multiple record(with delimited for fields and records) but run into the length limitation. This exception is showed in the log when I have a string which length is 105. When I have a smaller string it works.

                            which type of data is more suitable for a longer string datatype in SDK?

                            2006-10-23 12:54:15,852 ERROR [com.adobe.workflow.AWS] stalling action-instance: 868 with message: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]String or binary data would be truncated.

                            thanks!
                            Scott
                            • 11. Re: capturing the attributes of PDF elements
                              Community Member
                              Just figured out in the Workflow designer, I can change the length of process-level String variable. By default, it is 100...