Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-104548

QtPdf: provide feature to select text within a rectangular area

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • P5: Not important
    • None
    • None
    • PDF
    • None

    Description

      Some viewers like Okular and xpdf can do rectangular selections; whereas so far we have made text selection work more like it does in a text editor, where if you drag downwards you often get part of the first line, complete text of all lines in the middle, and part of the last line. Stumbled across this function which we don't use or expose yet:

      // Function: FPDFText_GetBoundedText
      //          Extract unicode text within a rectangular boundary on the page.
      // Parameters:
      //          text_page   -   Handle to a text page information structure.
      //                          Returned by FPDFText_LoadPage function.
      //          left        -   Left boundary.
      //          top         -   Top boundary.
      //          right       -   Right boundary.
      //          bottom      -   Bottom boundary.
      //          buffer      -   A unicode buffer.
      //          buflen      -   Number of characters (not bytes) for the buffer,
      //                          excluding an additional terminator.
      // Return Value:
      //          If buffer is NULL or buflen is zero, return number of characters
      //          (not bytes) of text present within the rectangle, excluding a
      //          terminating NUL. Generally you should pass a buffer at least one
      //          larger than this if you want a terminating NUL, which will be
      //          provided if space is available. Otherwise, return number of
      //          characters copied into the buffer, including the terminating NUL
      //          when space for it is available.
      // Comment:
      //          If the buffer is too small, as much text as will fit is copied into
      //          it.
      //
      FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,
                                                            double left,
                                                            double top,
                                                            double right,
                                                            double bottom,
                                                            unsigned short* buffer,
                                                            int buflen);
      

      So that's what's needed for that.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            srutledg Shawn Rutledge
            srutledg Shawn Rutledge
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes