5 Replies Latest reply on Oct 13, 2008 1:41 PM by Patrick Leckey

    getDataObjectContents

      So, if I do this:

      Document -> Attach a File

      and then in the js console type "this.dataObjects", there is 1 object in the list.

      But if I instead do this:

      Tools -> Comment & Markup -> Attach File as Comment

      this.dataObjects is null.

      Is there any way to get a data object out of a comment in javascript?
        • 1. Re: getDataObjectContents
          Patrick Leckey Level 3
          You'll have to loop through the document annotations instead of the dataObjects.
          • 2. Re: getDataObjectContents
            Level 1
            Running these three lines at the console:

            doc.syncAnnotScan();
            var annots = doc.getAnnots();
            JSON.stringify(annots[1].getProps());

            Results in the following output. So I'm not sure how to get the data object out of the annotation

            {"FSCosObj":{},
            "attachIcon":"PushPin",
            "author":"mblandford",
            "borderEffectIntensity":0,
            "borderEffectStyle":"S",
            "contents":"Annotations.docx",
            "creationDate":{},
            "dash":[],
            "delay":false,
            "hidden":false,
            "inReplyTo":"",
            "intent":"FileAttachment",
            "lock":false,
            "lockContents":false,
            "modDate":{},
            "name":"1525cb9e-cd8a-4b38-bd37-6ca74c456b3b",
            "noView":false,
            "opacity":1,
            "page":0,
            "point":[375.3746643066406,1270.1563720703125],
            "print":true,
            "readOnly":false,
            "rect":[375.3746643066406,1253.1563720703125,382.3746643066406,1270.1563720703125],
            "refType":"R",
            "richContents":[{"text":"Annotations.docx"}],
            "rotate":0,
            "seqNum":2,
            "strokeColor":["RGB",0.25,0.3333282470703125,1],
            "style":"S",
            "subject":"File Attachment",
            "toggleNoView":false,
            "type":"FileAttachment",
            "width":1}
            • 3. Re: getDataObjectContents
              Patrick Leckey Level 3
              Not sure what "stringify" might be leaving out, try the following:

              var a = this.getAnnots(0); // get all annots on page 0
              if ( a != null ) {
              var p = a[0].getProps();// get the properties of first one
              for ( o in p ) console.println( o + " : " + p[o] );
              }

              Obviously change the page in getAnnots as necessary.
              • 4. Re: getDataObjectContents
                Level 1
                FSCosObj : [object CosObjShadow]
                attachIcon : Paperclip
                author : mblandford
                borderEffectIntensity : 0
                borderEffectStyle : S
                contents : Book1.xlsx
                creationDate : Mon Oct 13 2008 16:29:34 GMT-0400 (Eastern Daylight Time)
                dash :
                delay : false
                exdata : undefined
                hidden : false
                inReplyTo :
                intent : FileAttachment
                lock : false
                lockContents : false
                modDate : Mon Oct 13 2008 16:29:34 GMT-0400 (Eastern Daylight Time)
                name : 1e9ecf0a-9865-4e2e-a9b8-05444d25aa0b
                noView : false
                opacity : 1
                page : 0
                point : 183.3780059814453,1440.0999755859375
                popupOpen : undefined
                popupRect : undefined
                print : true
                readOnly : false
                rect : 183.3780059814453,1423.0999755859375,190.3780059814453,1440.0999755859375
                refType : R
                richContents : [object Aggregate]
                rotate : 0
                seqNum : 2
                strokeColor : RGB,0.25,0.3333282470703125,1
                style : S
                subject : File Attachment
                toggleNoView : false
                type : FileAttachment
                width : 1

                hm....

                var a = this.getAnnots(0);
                if ( a != null ) {
                var p = a[1].getProps().FSCosObj;
                for ( o in p ) console.println( o + " : " + p[o] );
                }

                undefined

                So, I could also do

                Comments -> Export to Data File

                And I do see the embedded xlsx inside the fdf. But that doesn't really help me, since I'm trying to sync these comments with a database and to do that I'd need it in javascript.
                • 5. Re: getDataObjectContents
                  Patrick Leckey Level 3
                  If it won't let you access the FSCosObj property, it may not be possible from JavaScript.