5 Replies Latest reply on Jul 9, 2012 3:22 AM by valeri_dzia

    annotation properties

    valeri_dzia Level 1

      Hello to all

       

      I am developping a PDF Viewer, my goal is :

      1) Send my PDF annotations to database and store them

      2) When I run my Viewer, all annotations, stored in database must be added automaticaly on my pdf document.

       

      In case of sample-text annotation it works.

       

      But when I add highlight type annotation it show them in right column of all annotation, not on the page.

       

      Which propertie is basic for this annotation's type?

       

      also

       

      when I add highlight annotations, and restart my application

       

      only one annotation's propertie ---> quads contains value, the others one are empty, it's normal?

       

      thanks

       

      Valery

        • 1. Re: annotation properties
          George_Johnson MVP & Adobe Community Professional

          How are you importing/creating the highlight annotations, exactly? If you're using JavaScript, it would be helpful to see the code you're using. Are you giving each a unique name?

          • 2. Re: annotation properties
            valeri_dzia Level 1

            Capture.PNG

            name is given automaticaly by acrobat

            another question : Is it possible to post an object annotation from javascript/pdf to javascript/html?

             

            I don't know if a way that I  am using is practical :

             

            /* javascript pdf */

            /* I create an object JSON by all annotation of my document :

               {"annotations : "[{annot1 with its properties},{annot2 with its properties},{annot3 with its properties},...................]}

            and I post it to my pdf/JavaScript */

            ...

            function getA(){

                return this.getAnnots();

            }

             

            function onMessageFunc( stringArray )

              {

                var a = getA();

                var str = "";

                var listAnnot = '{"annotations":[';

                if(a==null){}

                else

                    for(var i=0; i<a.length; i++)

                        if ( a != null ) {               

                            var p = a[i].getProps();

                            for (o in p) {

                                 if(o == "richContents")// Span array objet, I dont know how I post it

                                    {}

                                else if(o == "strokeColor")                  

                                    {

                                       for (sc in p[o])

                                        {

                                         if(sc == 0)

                                            str += '"' + o + '":' + '["' + p[o][sc] + '",';

                                         else if(sc == p[o].length-1)

                                            str += p[o][sc] + '],';

                                         else str += p[o][sc] + ',';

                                         }

                                   }

                                else if(o == "point" | o == "popupRect" | o == "rect" | o == "quads")

                                    str += '"' + o + '" : [' + p[o] + '],';

                                else

                                    str += '"' + o + '" : "' + p[o] + '",';                   

                               }

                            listAnnot += "{" + str.substring(0,str.length-1)+"},";

                            str = "";

                            }

             

            sendMess(listAnnot.substring(0,listAnnot.length-1)+"]}");

             

            }

            • 3. Re: annotation properties
              George_Johnson MVP & Adobe Community Professional

              I meant the code you're using to add the annotations to the PDF, not get them from a PDF. I may not be understanding what you're doing, but the screen shot shows the highlight annotation on the page. It is just in your viewer that it doesn't show up?

               

              Note that you can submit a PDF and include the annotations in an FDF or XFDF and parse it on the server, or just store it without parsing. But I think I'm missing something.

              • 4. Re: annotation properties
                valeri_dzia Level 1

                I am retrieving all annotation of document

                I manualy create an object JSON by retrieved annotations :

                {"annotations : "[{annot1 with its properties},{annot2 with its properties},{annot3 with its properties},...................]}

                I post it to html page as string

                My html page send this string to server by AJAX and they are stored in database

                when I restart my application, server post all annotation to pdf through html(my goal is showing all annotations stored in database)

                It works for text annotation, not highlight annotation

                • 5. Re: annotation properties
                  valeri_dzia Level 1

                  maybe I lose some basic properties of highlight annotation