Hello All,
Hope you are doing good!!
How can we remove the ? at the special charterers from the preview of document..
Here we are converting the file to HTML and using the microsoft interop we are previewing the file..
Here am adding the code and screenshot issues.
- public partial class Default : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- string res_url = "https://s3-us-west-2.amazonaws.com/talpal/candidate_resume/52935_1530807980AnilKumar-Sr.devops.docx";
- show_resume(res_url);
- }
- public void show_resume(string resume_url)
- {
- object documentFormat = 8;
- string randomName = DateTime.Now.Ticks.ToString();
- object htmlFilePath = Server.MapPath("~/Temp/") + randomName + ".htm";
- string directoryPath = Server.MapPath("~/Temp/") + randomName + "_files";
- object fileSavePath = Server.MapPath("~/Temp/") + Path.GetFileName(resume_url);
- string extension = Path.GetExtension(resume_url).ToLower();
- if (extension == ".pdf")
- {
- resume_viewer.Src = "doc Path";
- }
- else
- {
-
- if (!Directory.Exists(Server.MapPath("~/Temp/")))
- {
- Directory.CreateDirectory(Server.MapPath("~/Temp/"));
- }
-
- using (WebClient myWebClient = new WebClient())
- {
-
- myWebClient.DownloadFile(resume_url, fileSavePath.ToString());
- }
-
- _Application applicationclass = new Microsoft.Office.Interop.Word.Application();
- applicationclass.Documents.Open(ref fileSavePath);
- applicationclass.Visible = false;
- Document document = applicationclass.ActiveDocument;
-
- document.SaveAs(ref htmlFilePath, ref documentFormat);
-
- document.Close();
-
- string wordHTML = System.IO.File.ReadAllText(htmlFilePath.ToString(), System.Text.Encoding.ASCII);
-
-
-
-
-
-
-
-
- System.Data.DataTable dtjd = (System.Data.DataTable)Session["jd_cand_details"];
- string mandatory_skills = "html,javascript,java,.net";
- string[] arrskills = mandatory_skills.Split(',');
- for (int i = 0; i < arrskills.Length; i++)
- {
- TextInfo myTI = new CultureInfo("en-US", false).TextInfo;
- string skill_lower = myTI.ToLower(arrskills[i]);
- string skill_upper = myTI.ToUpper(arrskills[i]);
- string skill_title_case = myTI.ToTitleCase(arrskills[i]);
- string strhtml = wordHTML.Trim();
-
-
- wordHTML = wordHTML.Replace(skill_lower.Trim(), "" + skill_lower + "");
- wordHTML = wordHTML.Replace(skill_upper.Trim(), "" + skill_upper + "");
- wordHTML = wordHTML.Replace(skill_title_case.Trim(), "" + skill_title_case + "");
- }
- System.IO.File.WriteAllText(htmlFilePath.ToString(), wordHTML, System.Text.Encoding.ASCII);
- string filename = "http://localhost:61950/Temp/" + randomName + ".htm";
- resume_viewer.Src = filename;
- }
- }
- }
- }
- .wrap
- {
- width: 500px;
- height: 750px;
- padding: 0;
- overflow: hidden;
- }
- .frame
- {
- width: 650px;
- height: 750px;
- border: 0;
- -ms-transform: scale(0.75);
- -moz-transform: scale(0.75);
- -o-transform: scale(0.75);
- -webkit-transform: scale(0.75);
- transform: scale(0.75);
- -ms-transform-origin: 0 0;
- -moz-transform-origin: 0 0;
- -o-transform-origin: 0 0;
- -webkit-transform-origin: 0 0;
- transform-origin: 0 0;
- }