C1FlexViewer - Search without jumping to search result

Posted by: daniel.erdei on 20 January 2022, 12:05 am EST

  • Posted 20 January 2022, 12:05 am EST

    Hello,

    I have a quick question regarding search through the contents of a PDF file with C1FlexViewer.

    I use C1FlexViewer.Pane.SearchText() to search for a certain term. This method highlights all the search results and jumps to the first/next one.

    My problem is, I would like to only highlight the results, but not to jump/scroll to the first or next search result. Is this possible in any way? I have not found any overload for the SearchText method.

    If you have any further questions, feel free to ask.

    Best regards,

    Andreas

  • Posted 20 January 2022, 7:52 pm EST

    Hello Andreas,

    Thanks for contacting us.

    Highlighting searched text without navigating. This seems like a valid requirement. So we are discussing this requirement with the development team. We will get back to you once we have any update from them. [Internal tracking id - C1XAML-28786]

    Regards,

    Nitin

  • Posted 20 January 2022, 11:28 pm EST

    Hello Nitin,

    thanks for keeping me up-to-date on this one.

    To solve this problem temporarily, I would like to manually adapt the scrolling behaviour of C1FlexViewer. I would need the following two things:

    1. Get the current vertical and horizontal scroll position of C1FlexViewer or C1FlexViewerPane (I tried finding a property called VerticalOffset etc., like there is one in WPF’s ScrollViewer, but I couldn’t find any way to get the current scroll offset)

    2. Set the current vertical and horizontal scroll position of C1FlexViewer or C1FlexViewerPane (like in WPF ScrollViewer’s ScrollToVerticalOffset method) - so I can manually scroll to any offset I have saved before using the getter functions above.

    Is this possible with C1FlexViewer?

    Best regards,

    Andreas

  • Posted 21 January 2022, 12:44 am EST

    Addendum:

    The reason why I need to manually get and set the scroll positions is, because C1FlexViewer resets it’s scroll position when I change it’s visiblity (WPF visibility; collapsed vs. visible)

    e.g.

    • "* “I scroll to any position in the pdf”

    • “i hide the pdf viewer (visibility = collapsed)”

    • “after some time i bring it back to the UI (visibility = visible)”

    • “now the C1FlexViewer has lost its scroll positions”

      "

    Is there any way I can avoid losing the scroll positions when changing the visibility? If yes, I would not need the features in my last entry (getting/setting scrollpos manually)

    Best regards,

    Andreas

  • Posted 23 January 2022, 8:50 pm EST

    Hello Andreas,

    JFYI, there’s no offset property available. We also can’t get scrollbar through template, because scrollbars are the part of C1FlexViewerPane which is not specific to wpf. So there’s no way to get or set offset. We can navigate through page numbers.

    You can store PageNumber before hiding the Flexviewerpane. And set PageNumber after showing the FlexViewerPane to navigate to the saved page-number.

    There’s also a limitation, Suppose we are on page=2 and some part of page=1 is visible at the top. After hide/show, if we restore the saved current page(2). The Page 2 will visible from top and page=1 will gets out of the view. This is expected, the changed page will displays from top.

    Please refer the attached sample for the same : FlexViewerHideShowNavigation.zip

    Best Regards,

    Nitin

  • Posted 23 January 2022, 9:52 pm EST

    Hello Nitin,

    thanks for your tip.

    However, losing the scroll offset is a massive deterioration compared to the old C1PdfViewer (which is deprecated). We have multiple PDF-viewer instances in multiple tabs and whenever the user switches to any tab, the PDF-viewer looses it’s scroll offset. And jumping to a specific page is not nearly good enough as the user will loose it’s orientation.

    In fact, this behavior makes the whole control unusable and even forces us to keep using the old C1PdfViewer as that does not loose the scroll offsets. Unfortunately, we found a deal-breaker here and therefore we can not use and buy the C1FlexViewer.

    Best regards,

    Andreas

  • Posted 23 January 2022, 11:34 pm EST

    Hi Daniel,

    We apologize for any inconvenience caused to you.

    There have been a misunderstanding at our end. And your reported behavior doesn’t seem to be valid. So, we have escalated it to the devs and will get back to you as soon as there is any update regarding the same.

    Best Regards,

    Nitin

  • Posted 24 January 2022, 2:09 am EST

    Hi Nitin,

    no worries - thank you for keeping me up-to-date on this one!

    Best Regards,

    Andreas

  • Posted 27 January 2022, 7:11 pm EST

    Hello Nitin,

    any update on this one? This bug has already gotten very urgent for us.

    Best Regards,

    Andreas

  • Posted 27 January 2022, 7:49 pm EST

    Hi,

    Thanks for your patience.

    When FlexViewerPane is hidden, all elements inside it will have their bounds (which contains information about scroll offset) reset. JFYI, FlexViewer doesn’t expose anything to get/set information of current scroll location because scroll location is quite complicated, it involves many calculation of matrix, zoom scale, pages.

    So, we are sorry to inform you that this is the design behavior and Unfortunately there is no workaround available for it.

    Best Regards,

    Nitin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels