0

I have a scenario in my application in which user can upload business case document which is word document, and other users(admin and super admin) can see that business case and approve the document.

What is happening is admins and super admins have to download word document , which i don't want , i want them to see that document in a pdf format.

I could do that by restricting the user to upload only pdf files but that is not i want , I want him to upload word document and at the time of saving that file in to server , i want to save as PDF formtat .

Current code is working fine but it is saving file as word file , i want to save the file as pdf format.

int count = 0;
                foreach (HttpPostedFileBase file in emailasign.Files)
                {

                    var filename = "";
                    //Checking file is available to save.  
                    if (file != null)
                    {
                        var random = new Random();
                        filename = random.Next(111111, 999999).ToString() + Path.GetExtension(file.FileName);
                        var ServerSavePath = Path.Combine(Server.MapPath("~/UploadedFiles/") + filename);
                        //Save file to server folder  
                        file.SaveAs(ServerSavePath);
                        count++;
                    }
                    if (count > 1)
                    {
                        TempData["OrignalFile"] += "," + file.FileName;
                        TempData["FileName"] += "," + filename;
                    }
                    else if (count == 1)
                    {
                        TempData["OrignalFile"] = file.FileName;
                        TempData["FileName"] = filename;
                    }
                }

Note: Right now it is accepting all format but i will restrict it in to word document only , so at the the time of uploading the document , i want to convert it in to PDF format and than save it on server

Faizan
  • 542
  • 5
  • 16
  • Possible duplicate of [How do I convert Word files to PDF programmatically?](https://stackoverflow.com/questions/607669/how-do-i-convert-word-files-to-pdf-programmatically) – usselite Oct 23 '18 at 06:43
  • Why is a PDF file important? Are the admins viewing in a browser? If the admins want to view the document in a browser, why not view the Word document? – Ryan Oct 23 '18 at 06:49

0 Answers0