Retreiving attachments from PDF

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

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);

Similar Messages

  • Get attachments from pdf

    I have a problem that is urgent. I want to extract attachements from a pdf file using java apis. I started from an example buf the BIG problem is that i don't have a documentation for certain java classes.<br />A piece of my code:<br /><br />PDFDocument pdfDoc = pdfFactory.openPDF(pdfFile);<br />try{<br />      EmbeddedDataObject[] edoList = pdfDoc.getDataObjectList();<br />      if (edoList.length>0){<br />         for(int i=0;i<edoList.length;i++){<br />        try{<br />           DataBuffer edodb = pdfDoc.exportDataObject(edoList[i].name);<br /><br />        }<br />        catch (Exception e){}<br />}<br />catch (Exception e){}<br /><br />DataBuffer is com.adobe.service.DataBuffer, buf i can't find documentation for it.<br />Please help.<br /><br />Regards, bogdan

    If you need code-level help, you should open a formal support incident with our Developer Support folks.
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Tue, 24 Jan 2012 23:13:52 -0800
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: How to get file attachments from a pdf.
    Re: How to get file attachments from a pdf.
    created by poortip87<http://forums.adobe.com/people/poortip87> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/4163393#4163393

  • Including attachments from PDF in Save as Draft and Submit as XDP

    When I wrote the first large process years ago, I ran into the problem of saving attachments that are in the PDF. If you ask the question, the response will be that you have to submit as PDF. That in turn has it's own other problems which when trying to solve, the answer given is "That is because you are submitting as a PDF". I have seen many ask the same thing I wanted: Submit as XDP, but include the attachments. This also includes that the built in Save Draft save them too.
    The summary is this: Loop through the attachments in JavaScript, Base64 encode them and stick them into the DOM. On the server side, use a script step to loop through and create a map of document objects to pass to the next render.
    The following needs to be called from a preSubmit event passing event.target. You'll need to add the nodes referenced to your schema.
    function embedAttachments(oParent) {
        // Get the list of attachments
        var oDataObjects = oParent.dataObjects;
        //app.alert(oDataObjects);
        var rootNode = xfa.datasets.data.resolveNode("[Your Data Root Node]");
        var oAttachData = rootNode.nodes.namedItem("FileAttachments");
        var oldNodes = oAttachData.nodes;
        //wipe out empty nodes
        while (oldNodes.length != 0) {
          oldNodes.remove(oAttachData.nodes.item(0));
        if (oDataObjects != null) {
          var count = oDataObjects.length;
          if (count > 0) {
              // Loop through all the attachments
              for (var i = 0; i < count; i++) {
                // Grab the next attachment
                var oFile = oParent.getDataObjectContents(oDataObjects[i].name);   
                  // Get a new stream with the image encoded as base64
                var vEncodedStream = Net.streamEncode(oFile, "base64");
                // Get a string from the stream
                var sBase64 = util.stringFromStream(vEncodedStream);
                  //console.println(sBase64);
                  // Copy the data to the XML
                var oNewNode = xfa.datasets.createNode("dataGroup", "FileAttachment");
                oAttachData.nodes.append(oNewNode);
                var oName = xfa.datasets.createNode("dataValue", "FileName");
                var oDesc = xfa.datasets.createNode("dataValue", "FileDesc");
                var oData = xfa.datasets.createNode("dataValue", "Base64Data");
                oName.value = oDataObjects[i].path;
                oDesc.value = oDataObjects[i].description;
                oData.value = sBase64;
                oNewNode.nodes.append(oName);
                oNewNode.nodes.append(oDesc);
                oNewNode.nodes.append(oData);   
    It also needs to be called from ContainerFoundation_JS in the form bridge.
    Add this variable:
    var thisDoc = null;
    Add this line of code at the top of RegisterMessageHandler:
        thisDoc = event.target;
    Add this line of code to the top of getData function:
    xfa.form.[Root Node].[Script Object].embedAttachments(thisDoc);
    Here is the Java code to add to a script object. I put mine in a custom render.
    import java.util.HashMap;
    import java.util.*;
    import org.w3c.dom.*;
    import com.adobe.idp.Document;
    import org.apache.commons.codec.binary.Base64;
    int count = 0;
    Map attachmentMap = new HashMap();
    Node ndAttach = patExecContext.getProcessDataValue("/process_data/xmlData/Formdata/FileAttachments");
    if (ndAttach != null) {
        NodeList children = ndAttach.getChildNodes();
        if (children != null) {
            count = children.getLength();
    for (int i = 1; i <= count; i++){
        String name = patExecContext.getProcessDataStringValue("/process_data/xmlData/Formdata/FileAttachments/ FileAttachment[" + i + "]/FileName");
        String desc = patExecContext.getProcessDataStringValue("/process_data/xmlData/Formdata/FileAttachments/ FileAttachment[" + i + "]/FileDesc");
        String b64Data = patExecContext.getProcessDataStringValue("/process_data/xmlData/Formdata/FileAttachments/ FileAttachment[" + i + "]/Base64Data");
        if (b64Data != null && b64Data.length() != 0) {
            Document attDoc = new Document((new Base64()).decode(b64Data.getBytes()));
            attDoc.setAttribute("basename", name);
            attDoc.setAttribute("description", desc);
            attDoc.setAttribute("wsPermission", "1");
            attDoc.passivate();
            attachmentMap.put(name, attDoc);
    patExecContext.setProcessDataMapValue("/process_data/mapAttachments", attachmentMap);
    After I wrote that, I realized there is a method to create a document from Base64. Since I can inspect the map during record and play back and see that the documents are stored Base64, I think I could speed up the process by changing to the other method. I am assuming it would prevent a decode then encode. This same technique might also be applied to annotations.

    Revised Execute script. Server was running out of heap space with large attachments. Creating the Document objects as temp files instead of in memory solves that. I also added the part that wipes the Base64 Attachments out of the XML.
            int count = 0;
            Map attachmentMap = new HashMap();
            String name="";
            String b64Data="";
            File tempFile=null;
            FileOutputStream outStream=null;
            Document attDoc=null;
            int i=0;
            Node ndAttach = (Node) patExecContext.getProcessDataValue("/process_data/xmlData/Formdata/FileAttachments");
            NodeList children;
            Node childNode = null;
            if (ndAttach != null) {
                children = ndAttach.getChildNodes();
                if (children != null) {
                    childNode = children.item(i);
                    if (childNode instanceof Element) {
                        System.out.println("tag name: " + ((Element)childNode).getTagName());
                    count = children.getLength();
            for (i = 1; i <= count; i++){
                b64Data = patExecContext.getProcessDataStringValue("/process_data/xmlData/Formdata/FileAttachments/FileAttachment[" + i + "]/Base64Data");
                if (b64Data != null && b64Data.length() != 0) {
                    name = patExecContext.getProcessDataStringValue("/process_data/xmlData/Formdata/FileAttachments/FileAttachment[" + i + "]/FileName");
                    tempFile = File.createTempFile("Attachment", ".tmp");
                    outStream = new FileOutputStream(tempFile);
                    outStream.write(Base64.decodeBase64(b64Data.getBytes()));
                    outStream.close();
                    attDoc = new Document(tempFile, true);
                    attDoc.setAttribute("basename", name);
                    attDoc.setAttribute("description", patExecContext.getProcessDataStringValue("/process_data/xmlData/Formdata/FileAttachments/FileAttachment[" + i + "]/FileDesc"));
                    attDoc.setAttribute("wsPermission", "1");
                    attachmentMap.put(name, attDoc);
            patExecContext.setProcessDataMapValue("/process_data/mapAttachments", attachmentMap);
            while (ndAttach.hasChildNodes()) {
                ndAttach.removeChild(ndAttach.getLastChild());

  • Trouble retreiving attachments from fillable forms

    I have created a fillable form for our customers to submit with responses.  They can type a response in a box or attach a document, which may be a Word doc or a pdf.  The forms containing their responses are collected in the responses file created when the form is distributed.  I can open each response and then open the attachments.  I want to be able to export all data from the forms that are submitted, including any attachments.  I successfully exported the data from the forms to Excel but the attachments are not transferred.
    Does anyone have any ideas on how I might transter the attachments to a database? 

    Such a transfer is a problem if you are not extremely specific about the software. Generally, such an attachment is just that so that you can save it, but not for converting some arbitrary format into a different format for a database. You are probably asking a bit much.

  • Convert attachments from pdf to jpeg

    I received some photos as pdf attachments and i need to convert them to jpeg to save them in my iPhoto library

    Drag the Preview application from your Applications folder to the Dock, if it is not already there.
    Then save the attachments to your Desktop from Mail.
    Drag each attachment to the Preview icon to open it in Preview.
    Alternately, you can right-click or ctrl-click a document and use the command "Open with" from the contextual menu to force the document to open in a specific application.

  • Mail changes my attachments from PDFs to Jpegs - Help!!

    I have to send PDF visuals to my clients but sometimes when I attach the PDF to the email, Mail converts it to a Jpeg, which is no good as it looks crap at the other end. Has anyone else seen this ? Is there a way to stop it ?

    Hello, and welcome to the Discussions.
    I have produced this problem, but only when having first attached another file, and used the size button to reduce the size from Actual. After the change from Actual Size, then a PDF would be presented as a JPEG.
    However, in all tests, if the first act of attachment was the PDF, the starting position was Actual Size, and the PDF remained a PDF file. You cannot use the Size button to reduce the size of PDF files, but must go other routes.
    I have reported this behavior, however, the only problem in my opinion, is that a file type can be changed without warning, and not the function of this size button. The size button is really intended to allow easy resizing of photos, and probably should be limited to photos. For example, if a .tif file were switched to .jpg, it is still an image, and convenient size to send is made possible.
    More info, please, about your exact experience.
    Ernie

  • How can I print PDF attachments from ABAP report in transaction ME23N?

    Hi,
    Users attach PDF files using "services for objects" in transaction ME23N.
    How can I print the PDF attachments from ABAP report ?
    Thanks in advance,,

    Hi,
      check this link,this might help you to solve your problem
    /people/thomas.jung3/blog/2005/04/28/setting-up-an-adobe-writer-for-abap-output
    Regards
    Kiran Sure

  • Unable to view PDF attachments from my iPhone.

    I am using service called RightFax this service is send the faxes to clients mailboxs. I have been reported from clients that they are unable to view the attachmentson their iPhones, the attachment format is PDF. The attachment can be openned from any desktops and Android phones without any issue.
    i can see attachment from on my iPhone but when i tab on it to view it it just scrolled up to the top of the mail. Also if i farward the same fax mail to my self then i can view the attachment.The IOS version is 7.1.
    I contact the RightFax company to check with them why only attachments from fax mails with PDF format is not openning from iPhone devices from the first time, the company check theur services and do tests and reply me that there is no issue with their services since the PDF attachments are openned on android and desktops. They informed me that it might could be compatability issue between Exchange 2013 and apple that doesn't allowed PDF attachments to be openned from the first time, so they advised to contact Apple support to find out why PDFs are not openning when i initially attempt to download them.
    I download third party mail client on my iPhone and all fax attachments are openned without problem.
    Could anyone help me with this strange issue ??

    RightFax advised you to contact Apple Support - this is NOT Apple Support but rather a public user to user technical support forum.
    As far as I know, it is not possible to open PDF attachments on an iPhone, but it is on an Android phone, which is why you are having the problems - unless there is an app to help you that you can purchase in the app store, then there is not a lot you can do about this, except switch to an android phone, but as far as I know, you have never been able to open PDF documents on an iPhone.

  • Can't open PDF email attachments from mail app. (iOS7, iPad2)

    Since upgrading to iOS7 I cannot open PDF email attachments from the "Mail" app. The attachment appears as a "tap to download" icon, after downloading it appears as an image of the first page of the PDF. An extended press of the PDF image results in "save image" and "copy" options, but no "open in" option.
    I have tried closing and re-opening mail, restarting the iPad, several different attachments. Still no "Open in" option.
    Any help with this?

    I work in a support organization and we've seen variations of this issue develop on various iphones and ipads with ios7.  Oddly, not everyone is experiencing this, just some people.
    In my own case, I simply downloaded Acrobat Reader for free and can read the things fine.
    We use an exchange activesync email server and when each email comes in it indicates at the very bottom that it has been downloaded as plain text and to click to download the entire message.  I've tried clicking to download and not clicking and I can read the PDF either way.
    In my own case I can view PDF files and/or also save them by pressing and holding the icon of the PDF in the email.
    The other thing one of our end users noticed: if she emailed the PDF directly to her iPhone5 and iPad it would not be readable but if she forwarded it to her offsite Yahoo account and then forward to her corporate email it would open.
    I think there's definetely something going on with the formatting of the PDF (was it created by a true Adobe PDF distiller or one of the many clones?), what email application attached it? (Outlook, Eudora, IOS Mail, etc) and how many PDF reading apps are on your IOS devices?
    For instance I have the default PDF reader, iBooks, Kindle, Adobe Acrobat Reader, and there may be others that I don't even know has PDF capability.   Only Apple probably has a good idea of how many apps utilize this.
    Message was edited by: aliensporebomb - clarification

  • Can't download PDF attachments from Hotmail

    Hi,
    For the past 3 - 4 weeks, I have been unable to download PDFs attached to Hotmail messages.  The Windows forum has been unable to help.
    I'm running Windows 7, IE 9 and using Acrobat X standard.
    So far I have cleared my cache and reinstalled silverlight as the Windows guys suggested.  I also restored my computer to a point in the past when I could download attachments.
    I can download PDFs from web sites, and open existing documents.  I cannot download PDF attachments from other email accounts (such as my academic account).
    Any thoughts?

    If there is an option to download in binary mode, be sure that is selected. I do not have HotMail and have no clue what options might be available.

  • How to Stop Large PDF attachments from displaying?

    Using Leopard and large PDF attachments (9mb) slow Mail down to a crawl. Is there a way to stop attachments from automatically displaying in Mail. It can be all atachments, it does not have to be just PDF or a certain size.
    Dan

    Hi Mulder,
    I think it must be noted that Plain or Rich Text has no bearing on Mail's ability to View in Place. Nor does View in Place have any bearing on each attachment being a true attachment. Whether it is viewed Inline by the recipient will depend entirely on the recipients email client, and not how you send.
    View in Place must not be confused with embedding images into text. The frequent discussion in these forums, and what you refer to, about whether to use Plain Text or RTF is relevant to some recipient email programs seeing inline attachments as embedded images due to the presence of the HTML that results from RTF when multiple fonts and attachments are present. The fact that the person composing sees the attachments with View in Place has no bearing on this issue involving HTML that results from RTF.
    Choosing the View as Icon while you Compose has no bearing on how the recipient's email application displays it.
    With those email clients where you can select to not view attachments inline, those you find viewing in place as you compose will in fact be seen as attached files in Icon form.
    At my request, I was sent a test message with a JPEG prepared using Iconiser -- Mail still displayed the JPEG in the message with View in Place when received. However, an examination in Raw Source form showed the header to the attachment did not have the disposition as "Inline" as it normally would -- this would aid with some recipients, such as those using Lotus Notes, where the attempt to adhere to the inline quality causes problems. But Mail, and some other email clients, can still display the message with attached images with View in Place or Inline View. The use of Iconiser will not guarantee to change that.
    As you have pointed out, zipping will prevent any form of View in Place from working.
    All the best,
    Ernie
    Message was edited by: Ernie Stamper

  • I can't access pdf attachments from my aol email on my ipad. i have downloaded adobe reader. what should i do?

    i can't accesspdf attachments from aol email on my ipad. i have donloaded adobe reader. what should i do?

    For Notes, if they are only on your phone I suggest you open them one by one and email them to your self so you have a backup of the text.  You can then go to Settings>iCloud and turn Notes to Off, then back On.  Then try creating a new note and see if it syncs properly to icloud.com and to your Mac.  If so, and if turning it notes off deleted the notes from your phone, you'll have to open each email and copy and paste the text into a new Note.
    My own experience with photo stream syncing photos to iPhoto is that it works great.  iPhoto automatically receives new photos from photo stream, and if configured to in iPhoto settings, it also saves a copy of the images to your iPhoto library so they are backed up.

  • Can you sync attachments from an iPhone to a Windows PC with Outlook 2007?

    Can you sync attachments from an iPhone to a Windows PC with Outlook 2007? I would like to receive email on the iphone with attachments and then sync the attachments to a Windows XP PC with Outlook 2007 without Outlook 2007 having to connect to the mail server itself and having to separely download the attachment. Is this possible?
    I have only tried one pdf file which downloaded wonderfully to the iPhone. I synced to the PC without the PC being connected to the email account. This also worked except that when I tried to open the attachment on the PC I got a message that the mail wasn't fully downloaded. When I went on=line on the PC, it downloaded the attachment. I would love to have this option because I can't access some email accounts from my corporate computer.

    Can you sync attachments from an iPhone to a Windows PC with Outlook 2007? I would like to receive email on the iphone with attachments and then sync the attachments to a Windows XP PC with Outlook 2007 without Outlook 2007 having to connect to the mail server itself and having to separely download the attachment. Is this possible?
    No it is not. The only information synced regarding email accounts is the email account information only and this is in one direction only - from your computer to the iPhone via iTunes.

  • How do I download attachments from Facebook to my iPad Air???

    Hello, how do I download attachments from Facebook [messages] to my iPad Air?? I have a PDF file I would like to download, but there's no options/button for me to press and start downloading. PLEASE HELP!

    click download at the bottom left corner of the particular pic you want

  • How to migrate attachments from legacy system to SAP.

    Hello experts,
                            We have a requirement to migrate attachments from a legacy application to SAP .Attachments are in the form of a PDF, xls, powerpoints. These are to be attached to accounts, opportunities etc.
       Please provide your inputs on how this can be achieved.
    Thanks in advance.
    Chandana.

    RH,
    Do a search in this forum for the class CL_CRM_DOCUMENTS.  That should give you some more ideas on document upload into CRM.
    Take care,
    Stephen

Maybe you are looking for

  • How to fetch the open order,open delivery and open billling into BI.

    Hi gurus,                   In FI-AR, table KNKK is not populating the value SALES VALUE- SAUFT. I need to fetch this value into BI i.e opne deliveryopen orderopen billing. We have the function modules CREDIT_EXPOSURE AND SD_CREDIT_EXPOSURE. But need

  • Problem with Append mode in File Receiver

    Hello, I am facing some problem with Append Mode in File Receiver. In channel config, i have given : Construction Mode : Append File Type : Text Message Protocol : File Content Conversion The size of the file which i am trying to send is about 9.5MB.

  • Cascading Style Sheets in JEditorPane..

    I have created a Java program that displays an HTML page in a JEditorPane. The JEditorPane seems to have a problem displaying pages with internal Cascading Style Sheets. The app grabs an HTML file off my and displays it in the JEditorPane but the fil

  • Sailing windy block font

    hello guys, I am making a homepage for my sailing club. Attached is the sort of old "Scouty" image I am sourcing. Do you know what type of font is used in the heading? Can you think of a nicer font to try? Alex

  • [SOLVED] Trouble setting up KVM VGA passthrough using vfio

    Hi all! In the past two weeks I've set up my first LFS build using Arch and everything is working great! Well, almost everything. I'm trying to get a VM set up with vfio for Windows gaming but I'm having trouble and I don't know where to look to fix