7 Replies Latest reply on Feb 22, 2008 3:56 AM by (Tom_Makó)


    Level 1

      I couldn't find anything in the forum regarding SetCurrentHighlight() bug so maybe I am the only one who would like to use it. But there's no problem :-)
      The documentation of the method's parameters is a little bit confusing at first sight.
      void setCurrentHighlight(LONG nLeft, LONG nTop,LONG nRight, LONG nBottom);
      nRight The width of the bounding rectangle.
      nBottom The height of the bounding rectangle.
      Is the nRight param is right coordinate or a width value? And this is the same for nBottom. But OK, it doesn't matter. Let's try it.
      After an hour digging I have a idea what's wrong with this method.
      As I see the right param description should look like this:
      void setCurrentHighlight(LONG nLeft, LONG nRight, LONG nTop, LONG nBottom);
      The values are coordinates and one more interesting thing. This method calculates coodinates based on bottom-left origo, despite other methods like setViewRect() on top-left origo.

      Has anybody else have this experience also or I'm alone?

        • 1. Re: Reader+OLE+SetCurrentHighlight
          Patrick Leckey Level 3
          As is documented in the PDF Reference, all coordinates relating to a PDF document have a bottom-left origin. Since SetViewRect affects the viewer and not the PDF itself, it uses a top-left origin.

          You can find the PDF Reference here:
          • 2. Re: Reader+OLE+SetCurrentHighlight
            gkaiseril MVP & Adobe Community Professional
            You might find the following link interesting:

            Automating placement of annotations - Converting coordinates in Acrobat by Thom Parker


            It describes how to deal with the "roatated" pages.
            • 3. Re: Reader+OLE+SetCurrentHighlight
              Level 1
              Thank you guys, both are very useful.
              I just read the IAC doc and these things wasn't described too exactly. At least for me...
              Now it's ok, the interesting coordinate system notice is not interesting, ignored.
              Independently from this question the wrong parameter order and documentation are still alive.

              • 4. Re: Reader+OLE+SetCurrentHighlight
                Patrick Leckey Level 3
                Can you post your example code? Using the values 0,0,100,100 worked as expected for me.
                • 5. Re: Reader+OLE+SetCurrentHighlight
                  Level 1
                  Hm. What is your environment?
                  I'm using Reader 8.1 through Internet Explorer from python but this code is like VB.
                  ie = com.Dispatch("InternetExplorer.Application")
                  ie.Visible = True

                  ie.Document.SetCurrentHighlight(0, 0, 100, 100)
                  #This last line does nothing

                  ie.Document.SetCurrentHighlight(0, 100, 100, 0)
                  # But this selects a box at the lower-left corner.
                  • 6. Re: Reader+OLE+SetCurrentHighlight
                    (Aandi_Inston) Level 1
                    >ie.Document.SetCurrentHighlight(0, 100, 100, 0)
                    ># But this selects a box at the lower-left corner.

                    That's correct and as per the documentation. Top=100, Bottom=0. This
                    is a normal reflection of the coordinate system. Where the Y
                    co-ordinates have lower values at the bottom, you can expect top >

                    Aandi Inston
                    • 7. Re: Reader+OLE+SetCurrentHighlight
                      Level 1
                      Aandi, you are almost right ;-)
                      The number 100 is a little bit confusing.
                      Try another number. For example:
                      ie.Document.SetCurrentHighlight(0, 50, 100, 0)
                      If the document is good, the result should be a horizontal rectangle, because left=0, top=50, right=100 and bottom=0.
                      But it is not horizontal in my case. It's vertical.
                      Therefore I think the right order is left=0,right=50,top=100,bottom=0.