Free Support Forum - groupdocs.com

Highlighting search words on page load


#1
Hi,

I've similar requirement which is mentioned in the following ticket http://groupdocs.com/Community/forums/thread/9157/is-it-possible-to-highlight-words-on-document-load.aspx.

When I apply the same javascript code in my aspx page it didn't work for me . I throws an error in javascript Uncaught Error: cannot call methods on groupdocsViewer prior to initialization; attempted to call method 'on'.

Can you please let me know what is the issue here

Here is my .aspx code


#2

Hello,


Thank you for your request. In the code example I can’t see the Viewer widget code which will put the Viewer to the web page. Since that you get such error. Please put this code to the web page and try again. If this will not help you - please provide more code examples or solution example that we can run and test it on our side.

Thank you.

#3
Thanks for your quick reply.
I'm binding Viewer Widget code in C# page and the code is

groupdocsViewercript = Viewer.ClientCode()
.Stream(stream, "demo", extension)
.TargetElementSelector("#test")
.EnableRightClickMenu(true)
.ShowThumbnails(true)
.OpenThumbnails(true)
.ZoomToFitWidth()
.ShowFolderBrowser(false)
.SupportTextSelection(true)
.ShowThumbnails(false)
.UseHtmlBasedEngine(true)
.PreloadPagesCount(3)
.SearchForSeparateWords()
.ToString();

I think if I didn't bind it properly then I cannot view the doc at all in browser. Search is working when I do manually but I want to do when page loads automatically with the specified key word.
If you need complete code I can attach.Thanks

#4

Hi,


Thank you for the code example. I was able to reproduce the issue, it happens if to use Stream, if you will use FilePath instead it will highlight the search value. Also I have created a bug ticket for our Product team - they will fix it and then I will notify you here.

Best regards.

#5

Thanks Pavel,

Actually we want to use Stream instead of filepath because this is fast and we don’t want to save any files on our hard disk. Can you please let me know once you fix this issue.

#6

Hi,


Sure I will keep you updated.

Best regards.

#7

Hi Pavel,

I’ve tried to implement highlighting Keywords on pageload using filepath but I get Filenot found exception. I’m using hard disc filepath to view attachment.Below is my sample code.

groupdocsViewercript = Viewer.ClientCode()
.FilePath(@“C:\inetpub\wwwroot\GroupDocs\documents\HARISH.K.doc”)
.TargetElementSelector("#test")
.EnableRightClickMenu(true)
.ShowThumbnails(true)
.OpenThumbnails(true)
.ZoomToFitWidth()
.ShowFolderBrowser(false)
.SupportTextSelection(true)
.ShowThumbnails(false)
.UseHtmlBasedEngine(true)
.PreloadPagesCount(3)
.SearchForSeparateWords()
.ToString();
I get an exception file not found when I try to view document on browser. Please let me know if I missing anything here or can you please give me any .aspx sample how to use this.Thanks

#8
Hello ,

Thank you for your request.

Basically, .File Path() parameter is an identifier of documents for storage folder and you are using this parameter not quite right. First you should configure SetRootStoragePath() parameter in Global.asax file , for example:

Groupdocs.Web.UI.Viewer.SetRootStoragePath(@"C:\inetpub\wwwroot\GroupDocs\documents\");

and then use file name in FilePath parameter:

.FilePath("HARISH.K.doc")

If you will have more questions please feel free to contact us.

------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#9

Thanks Evgen. I’m able to view doc using filepath but highlighting search Key word on pageload is not working with both options Stream and Filepath.


According to Pavel if I use Filepath it will work but it is not working for me. Can you please let me know what I’m missing. Thanks

#10

Hello,


We have tested the scenario and have managed to reproduce the same issue at our side with the GroupDocs.Viewer for .Net 2.18.0 version. For the sake of correction, we have logged this problem in our issue tracking system as WEB-2309. Also we have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for the inconvenience.

-------

Best regards,

Evgen Efimov


http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#11

Hi ,


We have deployed sample project here that you can test it. If search will work on your browser then we will share this sample with you.

Best regards.


#12

Thanks Pavel. It works for me . Please share sample(ASP.NET) with me.


#13

Hi,


Please download the sample project here and investigate the "SearchExample.aspx"

Best regards.

#14

Thanks for your support .


#15

Hi,

We want to search multiple words and phrases in Group docs viewer
SearchForSeparateWords() - by using this property we are able to search multiple words at asame time but not phrases eg: “software developer”.

Can you please let me know how to search multiple words and phrases .
Eg: Java, SQL and “Software developer”

#16

Hi,


Thank you for the question. To search multiple words and phrases you can try to separate them by commas. For example

Best regards.

#17

Hi Pavel,

We want to highlight exact phrase and seperate words only but in your example highlighting words of phase (to and fold). Is it possible to highlight words how,origami and exact match of phrase (to fold).Thanks

#18

Hi,


Thank you for coming back. Unfortunately our Viewer doesn’t support such feature. I will share it with our Product team and they will investigate it and if it will be possible we will add it to our road map.

Thank you.