page number for a given PDAcroFormField

Help
Leitender
2011-09-06
2013-05-28
  • Leitender

    Leitender - 2011-09-06

    Hello,

    I want to get the page number of a PDAcroFormField (where it is to be found).
    Is there a function in jPod that will tell me what the page number of a PDAcroFormField is?

     
  • mtraut

    mtraut - 2011-09-06

    Counterintuitively this is not a trivial task - and as such there's no simple "function".

    An acro form field is a logical construct that gets mapped to a page via its annotations. So, what you're looking for is the pag of the annotation. A field may have many annotations (repeating field on any page), so the best bet is to take any one of them (getAnyAnnotation). With the annotation, you could "getPage" - but this is not a mandatory field in the spec. Don't be surprised to get "null" here with documents in the wild. To get around this there's a method "PDAnnotationTools.getPage()", scanning the inverse association from each and every page…

    Ok, then, having the page you can ask for "PDPage.getNodeIndex", recursively climbing the page tree and computing the 0 based index.

    That's all….

     
  • Leitender

    Leitender - 2011-09-07

    Many thanks!

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks