Skip to content
Loading
  
  • "dvpdf" runat="server">  
  •   
  •   
  •   
  • CS file and this for word document(office)..
    1. namespace WordDocumentLoadSampleWebApp  
    2. {  
    3. public partial class LoadingWordDocument : System.Web.UI.Page  
    4. {  
    5. protected void Page_Load(object sender, EventArgs e)  
    6. {  
    7. }  
    8. protected void btnUpload_Click(object sender, EventArgs e)  
    9. {  
    10. object documentFormat = 8;  
    11. string randomName = DateTime.Now.Ticks.ToString();  
    12. object htmlFilePath = Server.MapPath("~/Temp/") + randomName + ".htm";  
    13. string directoryPath = Server.MapPath("~/Temp/") + randomName + "_files";  
    14. object fileSavePath = Server.MapPath("~/Temp/") + Path.GetFileName(FileUpload1.PostedFile.FileName);  
    15. //If Directory not present, create it.  
    16. if (!Directory.Exists(Server.MapPath("~/Temp/")))  
    17. {  
    18. Directory.CreateDirectory(Server.MapPath("~/Temp/"));  
    19. }  
    20. //Upload the word document and save to Temp folder.  
    21. FileUpload1.PostedFile.SaveAs(fileSavePath.ToString());  
    22. //Open the word document in background.  
    23. _Application applicationclass = new Application();  
    24. applicationclass.Documents.Open(ref fileSavePath);  
    25. applicationclass.Visible = false;  
    26. Document document = applicationclass.ActiveDocument;  
    27. //Save the word document as HTML file.  
    28. document.SaveAs(ref htmlFilePath, ref documentFormat);  
    29. //Close the word document.  
    30. document.Close();  
    31. //Read the saved Html File.  
    32. string wordHTML = System.IO.File.ReadAllText(htmlFilePath.ToString());  
    33. //Loop and replace the Image Path.  
    34. foreach (Match match in Regex.Matches(wordHTML, "", RegexOptions.IgnoreCase))  
    35. {  
    36. wordHTML = Regex.Replace(wordHTML, match.Groups[1].Value, "Temp/" + match.Groups[1].Value);  
    37. }  
    38. dvWord.InnerHtml = wordHTML;  
    39. }  
    40. }  
    +1
  • +1
    Check this link:
    https://www.e-iceblue.com/Tutorials/Spire.PDFViewer/Spire.PDFViewer-Program-Guide/How-to-view-multiple-PDF-files-from-one-Web-page-in-C.html 
    +1
  • +1
    Hey Leo,
     
    This is for Preview, Do we have any for Searching and Highliting the words...

    Below I am added for preview of word document and highliting of skills... 
    +1
  • +1
    You can use the DocumentViewer to preview the PDF and then search for the text using the DocumentViewerFindText object. Here are resources that will help you with this.

    https://www.leadtools.com/help/sdk/v22/dh/javascript/doxui/documentviewerfindtext.html
    https://www.leadtools.com/help/sdk/v22/tutorials/html5-get-started-with-the-document-viewer-demo.html
    +1