17 Replies Latest reply on Jan 30, 2009 2:07 PM by Aditya S.

    Retreiving attachments from PDF

    Aditya S. Level 1
      As you know, attachments can be added to PDF forms. I would like to know how can I retrieve these attachments and use them in Workbench ?

      Thanks
      Aditya
        • 1. Re: Retreiving attachments from PDF
          pguerett Level 6
          You will have to use the Assembler module to get attachments. This involves writing a DDX file to manipulate the PDF to get the attachments.
          • 2. Re: Retreiving attachments from PDF
            Aditya S. Level 1
            Is it included in any of the below licensed copies we have

            1)Forms
            2)Process Management
            3)Reader Extensions
            4)Output

            Or, would it be an addtional license purchase ?

            Thanks
            Aditya
            • 3. Re: Retreiving attachments from PDF
              pguerett Level 6
              No it is there ...look for the execute DDX under the foundation category. The DDX reference will be part of the docs.
              • 4. Re: Retreiving attachments from PDF
                Steve Bishop Level 2
                I am using:
                Category: Forms
                Service Name: FormsService
                Service Operation: processFormSubmission

                The attachments come in off that as a list. I am then using the following script to move into a map for use in a later render:

                import java.util.HashMap;
                import java.util.List;
                import java.util.Map;
                import java.util.Iterator;
                import com.adobe.idp.Document;

                List attachmentList = patExecContext.getProcessDataListValue("/process_data/lsAttachments");

                Map attachmentMap = new HashMap();

                Iterator it = attachmentList.iterator();

                while(it.hasNext()){
                Document attDoc = (Document) it.next();
                String name = (String) attDoc.getAttribute("name");
                attachmentMap.put(name, attDoc);
                }

                patExecContext.setProcessDataMapValue("/process_data/attachments",attachmentMap);
                attachmentList.clear();
                patExecContext.setProcessDataListValue("/process_data/lsAttachments", attachmentList);
                • 5. Re: Retreiving attachments from PDF
                  Aditya S. Level 1
                  I can't seem to find execute DDX.

                  I only get:

                  Invoke DDX
                  Invoke DDX One Document

                  How does DDX work. Do you have a sample ?

                  Thanks
                  Aditya
                  • 6. Re: Retreiving attachments from PDF
                    pguerett Level 6
                    The suggestion that S Bishop has given you is an easier means.
                    • 7. Re: Retreiving attachments from PDF
                      Aditya S. Level 1
                      S Bishop or Paul - Is it possible to view the attachment from the PDF as a form in Workspace ?

                      Aditya
                      • 8. Re: Retreiving attachments from PDF
                        pguerett Level 6
                        If you attach the attachments to the Task then you can view them.
                        • 9. Re: Retreiving attachments from PDF
                          Aditya S. Level 1
                          I don't want to view the attachment from the attachment tab. I would like to view it in the form tab.

                          My situation - I have multiple contracts I want to upload for viewing only. these contracts will have their own instructions and other details. I have assigned variables and XPATH'd to the variables to dynamically change.

                          I would like to design a form which will allow users to attach one contract and enter values in Textfields. The textfields will map the values (via XSD) to the workbench variables and the attachment will be the form they will view in Workspace.

                          To implement the above scenario I need to display an attachment as a form in Workspace.

                          So my question would be, if I use the processFormSubmission extract the attachment, can I use the same variable as the input form variable in the task ?

                          Hope I was clear enough.
                          • 10. Re: Retreiving attachments from PDF
                            Jasmin Charbonneau Level 4
                            You can use the same form, but you will have to ensure it contains some extra objects so it works properly in WorkSpace.

                            You need to make sure to add the Forms Bridge (Process Management/Form Augmenter/Inject Form Bridge) and a Submit button to your PDF(probably using Assembler and overlay a PDF with submit button)so you can submit using the "Complete" button in Workspace.

                            Jasmin
                            • 11. Re: Retreiving attachments from PDF
                              Aditya S. Level 1
                              Jasmin - I don't think that would be needed as the documents are "Read Only". I don't want the users to submit or complete the process.

                              I tried using the document variable from "Attachments" in the processFormSubmission module. When I view the process in Workspace I get a pop up asking me to save the document. It doesn't open within Workspace.

                              Would you like me to send you the LCA ?

                              Thanks
                              Aditya
                              • 12. Re: Retreiving attachments from PDF
                                Jasmin Charbonneau Level 4
                                " I don't think that would be needed as the documents are "Read Only". I don't want the users to submit or complete the process."

                                So the users are going to end up with a bunch of items in their ToDo, they can remove?

                                "When I view the process in Workspace I get a pop up asking me to save the document"

                                It's because Workspace doesn't know what content it is. I would store it in a Document Form variable (/process_data/object/@document) and use the Document Form as the form data mapping instead.

                                Jasmin
                                • 13. Re: Retreiving attachments from PDF
                                  Steve Bishop Level 2
                                  Aditya,

                                  I'm not sure I follow your sequence of events you are after.

                                  Here is some of what I think I understand:
                                  User clicks process which opens PDF form A.
                                  User attaches PDF form B to PDF form A.
                                  User clicks Complete.

                                  Next is where I lose your direction:
                                  1. You want Form B to be populated with some data and sent back to the user. I believe this is what Jasmin also thinks your intentions is. I am also lost as to why you would not want a button to close this process out.

                                  2. You want the submission of form A to immediately display form B. I'm not sure that is possible in Workspace, although I would be interested in how if it is. If there is no process, it could be done with a java servlet and APIs.
                                  • 14. Re: Retreiving attachments from PDF
                                    Aditya S. Level 1
                                    "So the users are going to end up with a bunch of items in their ToDo, they can remove?"

                                    Their ToDo is going to be used as a repository for "ReadOnly" contracts.

                                    "It's because Workspace doesn't know what content it is. I would store it in a Document Form variable (/process_data/object/@document) and use the Document Form as the form data mapping instead. "

                                    I assigned the Attachement variable to DocumentForm. I also used the SetDocAttribute function.

                                    /process_data/lsAttachments/object/@document=setDocAttribute(/process_data/@IsAttachmentsD oc, "wsfilename", "Test.pdf")

                                    This way the attachment has a content type. Nevertheless, I still get the pop up message asking me to save "test.pdf"
                                    • 15. Re: Retreiving attachments from PDF
                                      Aditya S. Level 1
                                      S Bishop - I am sorry if I have been unclear. You got it right in the second point

                                      I will reiterate the process.

                                      1) User opens PDF A
                                      2) User attaches PDF B to PDF A
                                      3) I would like the submission of PDF A to display PDF B (attachment) in Workspace.

                                      The issue is, PDF B doesn't open within Workspace. Instead, when I open the process in Workspace, it throws a pop up window asking me to save PDF B to a file system.

                                      I am trying to get PDF B to open within Workspace.

                                      Aditya
                                      • 16. Re: Retreiving attachments from PDF
                                        Steve Bishop Level 2
                                        /process_data/lsAttachments/object/@document=setDocAttribute(/process_data/@IsAttachmentsD oc, "wsfilename", "Test.pdf")

                                        That won't set the content type. I have not done it, but assume this will:

                                        /process_data/lsAttachments/object/@document=setDocContentType(/process_data/@IsAttachment sDoc, "application/pdf")
                                        • 17. Re: Retreiving attachments from PDF
                                          Aditya S. Level 1
                                          It worked !!

                                          Thanks guys. I am able to open the attachment in Workspace now.

                                          Aditya