List of attachments in PDF

How can we use javascript to get a list of attachments currently attached to our PDF document?
Thanks in advance,
Ali.

Thanks Mark for the tip.
I am using LiveCycle Designer ES to make the form, using javascript to get my functionality.
I tried to access the attachment names with your advice, by looping through the dataObjects. But it always gives the name "Untitled Object" no matter which document I attach.
I have tried to find resources to look for objects and properties that I need to check. From you I got to know that I need to look into the "dataObjects" object.
Also, I am wondering how to update my list of the attachments when the user adds or removes the attachments. Which event (where) should I place the code for updating my list.
Please help.
Thanks.

Similar Messages

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

  • How to convert a file of emails and the attachments to pdf?

    In adobe pro XI, how do you convert a file of emails AND their attachments to pdf?

    Unfortunately, that did not work either. I am thinking this may not be possible (at least with 10.1.3.4). What I was hoping for was that I could audit the presentation catalog groups and users. I want to be able to get a list of all the users and the groups they are listed in. Again, this would be helpful so we do not need to keep an external record. If we are removing access to a user or updating the group, we want to make sure we remove them from all applicable groups (Settings>Administration>Manage Presentation Catalog Groups and Users)

  • Viewing attachments to PDF files in Preview

    Hi all,
    Sometimes files are attached to PDFs so that the attached file (spreadsheet, movie, whatever) comes along with the PDF. It's easy to see the attached files using Acrobat Reader (you click on the paperclip icon), but I can't figure out how to see them in Preview. Is this possible? Please note that I am talking about attachments within PDF files, not PDFs attached to emails!
    Thanks in advance,
    wrathkeg

    I have exactly the same problem with PDFs containing bitmaps created by Illustrator CS3 (and CS4) -- the bitmap appears as negative.
    It has to do with the compression method used for the bitmaps in the Adobe PDF creation. If it is JPEG or JPEG2000 the problem occurs, if it's ZIP or no compression, the image is fine.
    If have reported this to Apple as a bug already.
    10.6.2 has NOT fixed this behaviour.

  • Print List Processing Report to PDF

    hi all,
    i've read many forums about convert info into PDF. but i'm very new to understand those forums.
    In case I want to print list processing report as PDF (not hard copy thru printer). First, user types the data on the screen then click on 'Execute' button, then the system shows the result on screen. After that user asks system for print the screen on menu bar by List=>Print.
    So please advise me how to get the spool id, then export as pdf. As my opinion, i may use CONVERT_ABAPSPOOLJOB_2_PDF and GUI_DOWNLOAD. But where is the place I should put the methods on?
    Thanks in advance.
    Peerasit

    Hi,
    Go through The simple Anallise this program.
    report zabap_2_pdf.
    *-- Enhancements: only allow to be run with variant.  Then called
    *-- program will be transparent to users
    *-- TABLES
    tables:
      tsp01.
    *-- STRUCTURES
    data:
      mstr_print_parms like pri_params,
      mc_valid(1)      type c,
      mi_bytecount     type i,
      mi_length        type i,
      mi_rqident       like tsp01-rqident.
    *-- INTERNAL TABLES
    data:
      mtab_pdf    like tline occurs 0 with header line,
      mc_filename like rlgrap-filename.
    *-- SELECTION SCREEN
    parameters:
      p_repid like sy-repid, " Report to execute
      p_linsz like sy-linsz default 132, " Line size
      p_paart like sy-paart default 'X_65_132'.  " Paper Format
    start-of-selection.
    concatenate 'c:\'
                p_repid
                '.pdf'
      into mc_filename.
    *-- Setup the Print Parmaters
      call function 'GET_PRINT_PARAMETERS'
       exporting
         authority= space
         copies   = '1'
         cover_page                   = space
         data_set = space
         department                   = space
         destination                  = space
         expiration                   = '1'
         immediately                  = space
         in_archive_parameters        = space
         in_parameters                = space
         layout   = space
         mode     = space
         new_list_id                  = 'X'
         no_dialog= 'X'
         user     = sy-uname
       importing
         out_parameters               = mstr_print_parms
         valid    = mc_valid
       exceptions
         archive_info_not_found       = 1
         invalid_print_params         = 2
         invalid_archive_params       = 3
         others   = 4.
    *-- Make sure that a printer destination has been set up
    *-- If this is not done the PDF function module ABENDS
      if mstr_print_parms-pdest = space.
        mstr_print_parms-pdest = 'LOCL'.
      endif.
    *-- Explicitly set line width, and output format so that
    *-- the PDF conversion comes out OK
      mstr_print_parms-linsz = p_linsz.
      mstr_print_parms-paart = p_paart.
      submit (p_repid) to sap-spool without spool dynpro
                       spool parameters mstr_print_parms
                       via selection-screen
                       and return.
    *-- Find out what the spool number is that was just created
      perform get_spool_number using sy-repid
                 sy-uname
        changing mi_rqident.
    *-- Convert Spool to PDF
      call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
        exporting
          src_spoolid= mi_rqident
          no_dialog  = space
          dst_device = mstr_print_parms-pdest
        importing
          pdf_bytecount                  = mi_bytecount
        tables
          pdf        = mtab_pdf
        exceptions
          err_no_abap_spooljob           = 1
          err_no_spooljob                = 2
          err_no_permission              = 3
          err_conv_not_possible          = 4
          err_bad_destdevice             = 5
          user_cancelled                 = 6
          err_spoolerror                 = 7
          err_temseerror                 = 8
          err_btcjob_open_failed         = 9
          err_btcjob_submit_failed       = 10
          err_btcjob_close_failed        = 11
          others     = 12.
    call function 'DOWNLOAD'
         exporting
              bin_filesize            = mi_bytecount
              filename                = mc_filename
              filetype                = 'BIN'
         importing
              act_filename            = mc_filename
         tables
              data_tab                = mtab_pdf.
          FORM get_spool_number *
          Get the most recent spool created by user/report              *
    -->  F_REPID               *
    -->  F_UNAME               *
    -->  F_RQIDENT             *
    form get_spool_number using f_repid
         f_uname
                    changing f_rqident.
      data:
        lc_rq2name like tsp01-rq2name.
      concatenate f_repid+0(8)
                  f_uname+0(3)
        into lc_rq2name separated by '_'.
      select * from tsp01 where  rq2name = lc_rq2name
      order by rqcretime descending.
        f_rqident = tsp01-rqident.
        exit.
      endselect.
      if sy-subrc ne 0.
        clear f_rqident.
      endif.
    endform." get_spool_number
    Regards
    swamy

  • How can I get my outlook 2011 to print a list of attachments to a message

    I can't get my Outlook to print a list of attachments when I print a message.

    Outlook is a Microsoft product. The forum is here:
    http://www.office-outlook.com/outlook-forum/

  • How to add attachments in pdf -URGENT

    Hi All,
    I need information about how to add attachments to pdf in webdynPro. I am unable to find related topics in Forums. Sample code,examples,or suggestions would be helpful.
    Thank you
    Regards
    Ravi

    Hello Ravi,
    Please take a look at: Add attachments to the Interactive form of a Web dynpro application
    Please take a look at my reply there on Mar. 29, 2007. I am not sure but i assume that you are using Web Dynpro for Java. Attachment capability is available with NW04s SP10 (both runtime and NWDS). Although, SP09 contains the required web dynpro runtime changes but the API has only been made part of SP10. Follow the note numbers provided therein.
    Best Regards,
    Krish

  • How do I get my ipad to recognise my pdf attachments as pdfs?

    My ipad does not always recognise a pdf file as as incoming mail attachment, so I cannot always open the pdf in another app.
    Although the attachment shows as a paperclip in the mail header, sometimes the content of the attachment is displayed in the body on the email. When this happens I don't get the small square window at the top right corner of the screen where you can select another app to open the pdf.
    How do I get my ipad to recognise my pdf attachments as pdfs and not show the content in the body of the mail message?

    This is from page 44 of the iPad User Manual:
    Open a meeting invitation or attachment: Tap the item. If the attachment can be used by multiple apps, touch and hold to choose an app that works with the file.
    Based on this, I suggest trying this:
    Touch and hold an area of the PDF file that displays in the body in your email.  Do you get the behavior described in the manual above?

  • Adding attachments to PDF in webDynPro-Urgent

    Hi,
    I need some information, how to add attachments to pdf in webDynPro. A sample code or examples or suggestions would be helpful.
    Thank You
    Regards
    Ravi.Golla

    Hi,
    Check the following links,
    Interactive PDF Form(Example):
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/dc/f1783fe3263042e10000000a114084/frameset.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/online%20interactive%20pdf%20form.pdf
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/offline%20interactive%20pdf%20form%20using%20download.pdf
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/dc/f1783fe3263042e10000000a114084/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/d1088b7e-0c01-0010-c78e-984c0537e3ec [original link is broken]

  • HT2500 Using Mail in System X 5.8 It will not accept attachments (photos, pdf files)

    Using Mail in System X 5.8 It will not accept attachments (photos, pdf files) to send. It was working just fine and after some period of non-use it just stopped accepting attachments to send. The system is all up to date. And, I have the same problem on two different Imacs.

    I had exactly the same problem as arthur1234. I followed his own suggested fix in his post of 10/12/2012 at 9:31 AM.
    His fix worked perfectly. Attachments are now being sent and received as they have been for the last 10 years or so.

  • How to get List Item attachments name without write any custom code or any database query?

    Hi,
    How to get List Items attachments name without write any custom code or any database query?

    You can get it from Rest,
    There are 2 options,
    1) create a 'Result Source' which has a search query for that List which has attachments 
     - Use rest query to get the 'Filename' , it will have the attachment file name 
    For example, if the result source id is : 73e6b573-abf8-4407-9e5f-8a85a4a95159 , then the query will be 
    http://[site URL]/_api/search/query?querytext='*'&selectproperties='Title,Path,FileExtension,SecondaryFileExtension,Filename'&sourceid='73e6b573-abf8-4407-9e5f-8a85a4a95159'&startrow=0&rowLimit=100
    You can refine the query, be giving proper 'querytext'
    2) Use the List rest api
    For example if your list guid is :38d524a1-e95c-439f-befd-9ede6ecd242e
    You can get he attachments for 1st item using this 
    http://[Site URL]/_api/lists(guid'38d524a1-e95c-439f-befd-9ede6ecd242e')/items(1)/AttachmentFiles
    get2pallav
    Please click "Propose As Answer" if this post solves your problem or "Vote As Helpful" if this post has been useful to you.

  • Save emails and attachments as PDF files

    I am wanting to save my emails and attachments as PDF files.  I have researched online and saw something through Adobe calle PDFMaker but I can't seem to find it.  I have downloaded the free trial of Acrobat DC but it doesn't seem to have that function - unless I am missing it.  Can anyone help?  Thanks in advance

    Hi tinas71250284,
    Which OS and email client are you using?
    Regards,
    Rahul

  • Can't print list of attachments

    Hi, I have a client who needs to print a list of attachments at the top or bottom of each email. This doesn't seem to be possible in Mail (latest version). Does anyone know of a solution?
    thanks,
    chuck
    MacSimize

    No. This is not possible.

  • I would like to convert convert PDF attachments to PDF.

    For example we have word files that are embedded as attachments inside PDF files that are in native format (docx). I need to have them converted to PDF. Is this possible?

    Rob,
    There is a great way to do that, but it requires a third-party plug-in to achieve the automation you're after.  It's called AutoPortfolio and is available from an Adobe Solution Partner called Evermap.  One of its many capabilities is the conversion of email contained in a Portfolio (Portfolios are the key ingredient here), which already contains the embedded attachments as a result of conversion from Outlook or Lotus Notes with Acrobat, to a standard or "flat" PDF.  As part of this process, it gives you the option to extract any embedded attachments and convert them to PDF, after which they will appear as an additional page in the resulting flat PDF file.  Nested bookmarks are also created as part of this process for both the parent email and each attachment. 
    Although you are only referring to a single email, this process can be applied to extremely large Portfolios, up to the limitations of your computer's RAM and CPU.  It has several other uses, but the process you are referring to is a flagship feature.     
    Disclosure:  I have no affiliation of any kind with Evermap, but did address the use of several of their products in my book, "The PDF Litigation Guide."
    Hope that helps!
    Jason Covey
    PDF Litigation Solutions, LLC
    www.pdflitigationguide.com

  • Adding attachments to PDF within ISR and possibly link to BDS in ESS

    I have a requirement where the user needs to attach documentation to a request (ISR) for approval.  From my research on this forum I see that currently SAP does not support attachments in a PDF within ISR as only a small subset of the xml data to render the form is actually saved as part of the request.  A person has the ability to add attachments to the form in the process but once the form is recalled from the work list and displayed the attachements are missing.

    Hello Guys,
    We are using Adobe forms with ISR framework and facing problems attaching the files  from within the PDF ; using the paper clip icon.
    Once the files are  attached to the PDF form and the form is submitted, attachment disappears from the Form . Instead we have to use a "Attachment Manager" on UWL to attach the files. It is quite Confusing to have a "Paper Clip" button inside the form and also a attachment manager on UWL.
    If anyone faced similiar issue and has solution to fix this, please let me know.
    We are on ECC6 with component SAP_BASIS - 701- 006- SAPKB70106.
    Thanks in advance.
    Regards
    Sandy
    Edited by: Sandy on Sep 6, 2011 5:18 PM

Maybe you are looking for

  • Boot Camp,installing windows 7 on hd bay 2 mac OS on hd bay 1, and only 0 and 1 are listed

    I know this is silly but, I have a seperate HD in bay #2 its formated NTFS ready to go for the Windows 7 install, my Mac OS X Lion HD is in bay #1, once booted into Windows and I begin to install PC OS, Windows askes me which drive. HD 0 or HD 1 now

  • Video newbie needs help with multicam editing

    Hi all, My video editing experience is limited to a few iMovie projects, which you can view on YT (search for TheChampsTube).  For our final gig we did a 3 camera shoot, which was supposed to be produced by the videographer.  But he dropped the ball,

  • AE freezes while Opening Project

    Been working on a project these past two days. Nothing over the top complicated in it. Animating text/solids with an audio bed. However this morning, while loading up the project, it froze at 33%. Had to Force Quit, try again. Nothing. I've actually

  • Formatting output to text file

    Hi, I need some help with formatting the output to a file. Is there a way we can change the size or font of the text written to a text file? Also can we set the line length (for eg. 80 characters). I want to ouput description and amount king of stuff

  • EXPORT SOUND PROBLEMS?

    Ok.. so i'm exporting my flash video, both sounds which are wav files work when i view them in flash.. when i export them as a quicktime.. i can only hear one of them?? I tried messing with the export settings but still nothing happens? I even re-imp