10 Replies Latest reply: Aug 19, 2009 7:53 PM by ChromeUser RSS

    about CosDocGetRoot

    ChromeUser Community Member

      I opened a text file by Acrobat 7.1.3 and save it with PDF to local hard drive.

      After that i use my plugin to add an custom annotation, just right after click my tool i call AVAppGetActiveDoc()——> AVDocGetPDDoc()——> PDDocGetCosDoc()——> CosDocGetRoot()——> CosObjGetID().

      The returned ID is not right.

       

      I test it on Acrobat 9 it's OK and if i open an PDF directly on Acrobat 7.1.3 it's OK.

      How can i get the right CosID?

        • 1. Re: about CosDocGetRoot
          lrosenth Adobe Employee

          What do you mean "right" Cos ID?  Is it not a valid ID?  Does it not give you the correct object?  Why do you even need the ID of an object?

          • 2. Re: about CosDocGetRoot
            ChromeUser Community Member

            I don't know if it's valid,but i open the PDF by a hex editor and find the "Catalog" ID is not the value returned by CosObjGetID().

            • 3. Re: about CosDocGetRoot
              lrosenth Adobe Employee

              When loaded into RAM, there is no promise that those IDs are stable.  Those are the IDs in the physical file at the time it is loaded - nothing more.

              • 4. Re: about CosDocGetRoot
                ChromeUser Community Member

                That is i should reload the file?

                • 5. Re: about CosDocGetRoot
                  lrosenth Adobe Employee

                  No, I am just telling you that the IDs in the file were NEVER guaranteed by the SDK to be consistent with the memory representation.   So if you built your solution around that, you may be (or have been) in for a shock.

                   

                  Can you explain why you need that actual object IDs (or that the IDs match the file)?

                  • 6. Re: about CosDocGetRoot
                    ChromeUser Community Member

                    The signature in PDF only ensure the content in sig range, for increment updated content it does not even for the updated content is another signature.

                    My task is parse the increment updated content after the signature.

                    If the updated content after the current sig is just a signature then current sig is valid.

                    So i need to know the object after the current sig.

                    I accomplish this by parsing the cross-reference table and find the object's offset larger than the sig range.

                    That's is why i should know the object's ID.

                    • 7. Re: about CosDocGetRoot
                      lrosenth Adobe Employee

                      Correct, the signature is over a given byte range.  Anything not in that range (such as stuff in subsequent update tables) is not included.

                       

                      So you are choosing to do your own validation rules rather than stick with those in Acrobat/Reader.  OK - that's your choice.

                       

                      There are API calls to let you find out how many incremental update sections there are (CosDocEnumEOFs, I think it is called) and then determine whether a given object lives inside it (CosObjGetOffset, I think).  No need to write your own parser, etc.

                      • 8. Re: about CosDocGetRoot
                        ChromeUser Community Member

                        I have checked the SDK reference and have not found the method "CosObjGetOffset",there is just a callback "CosObjOffsetProc" which should be called during saving proc.

                         

                        I have looked for the similar method before, but do not find it.so i parse the cross reference myself.

                         

                        Thanks.

                        • 9. Re: about CosDocGetRoot
                          lrosenth Adobe Employee

                          Sorry - the API call is CosDocObjIsWithinRange().

                          • 10. Re: about CosDocGetRoot
                            ChromeUser Community Member

                            Using this method i should enum all the indirect objects(by CosDocEnumIndirect method) in document and then judge whether if it is out of sig range.

                            I'm not sure when the document has large amount objects could cause the CosDocEnumIndirect slowly.

                            I will test this method.

                            Thanks.