How do I get the end word-index of a multi-page selection?

Ask a Question related to Adobe Acrobat SDK, Design and Development.

  1. #1

    Default How do I get the end word-index of a multi-page selection?

    Hi there,

    I have made a selection that covers several pages in continous view. I need to get the pagenumber and the word-index at the end of the selection.

    I have managed to get the end-page with AVDocSelectionEnumPageRanges, but that still leaves me without a clue of which word the selection ends at.

    If you get the selection-range with PDTextSelectGetRange and ask for the end (range->end) then it returns a word-index that equals the number of words on the first page of the selection, but this has nothing to do with the actual end of the selection, it just shows that the selection goes beyond the page.
    Note that a continous multi-page selection only results in 1 range count (PDTextSelectGetRangeCount()). It also says that in the documentation.

    Any help is appreciated.

    Thanks,
    Gitte
    Gitte_Thorvil@adobeforums.com Guest

  2. Similar Questions and Discussions

    1. Splitting or separating 1 multi page pdfdocument into individual page documents
      I am looking for any product that will take a multi page pdf file and burst or separate it into individual pdf files created from each page. Mac...
    2. Index selection issue
      Hi, I have an innodb table with about 8 million rows of data that has several indexes defined. While performing a select MySQL almost always...
    3. multi column index and order by
      Hello, "order by a asc b desc" how can I create an index for this? Mage ---------------------------(end of...
    4. How to make multi page MS Word to multi page pdf
      I have a five page MSWord X document that when exported to PDF only captures the first page. The document is sectioned(1st and 2nd pages are in...
    5. Login - multi table insert for registrant; subsquent login insert page requests into joined 'Selection' Table
      Question regards insert and updates in sql server for a simple login script that requires registration the first time and only "email address" upon...
  3. #2

    Default Re: How do I get the end word-index of a multi-page selection?

    I found a way (workaround) to solve my problem - If anybody is interested:-)

    Gitte

    * ******************************************

    static long g_selectedWordCount = 0;

    static ACCB1 ASBool ACCB2 PDTextSelectEnumTextProcCB(void* procObj, PDFont /*font*/, ASFixed *size*/, PDColorValue /*color*/, char* text, ASInt32 textLen)
    {
    std::string* returnStr = static_cast<std::string*>(procObj);
    returnStr->append(text, textLen);
    std::string theText(text);
    //Reset counter when New page occurs.
    //Right now I assume that \r\n alone indicates a new page
    // - so far it does!
    if (textLen == 2 && CRLF.compare(theText) == 0) {
    g_selectedWordCount = 0;
    }
    else {
    g_selectedWordCount++;
    }
    return true;
    }

    //The following is added to the method where you need the end word-index. This also gives you a string with all selected text.
    std::string returnStr = "";
    g_selectedWordCount = 0;
    PDTextSelectEnumTextProc cbPDTextSelectEnumTextProc = ASCallbackCreateProto(PDTextSelectEnumTextProc, &PDTextSelectEnumTextProcCB);
    // Enumerate the text runs in PDText
    PDTextSelectEnumText(ts, cbPDTextSelectEnumTextProc, &returnStr);
    ASCallbackDestroy((void*)cbPDTextSelectEnumTextPro c);

    long endWordIndex = g_selectedWordCount;

    * ******************************************
    Gitte_Thorvil@adobeforums.com Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139