There is no code to put in view in the documentation so my view is empty, similarly there is no code to put in web.config, so it’s as it is
global
protected void Application_Start()
{
GroupdocsConversion.SetRootStoragePath("~/App_Data/");
GroupdocsConversion.Init();// initialize Conversion control
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
controller
using Groupdocs.Common;
using Groupdocs.Web.UI.Conversion;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace DocConversion.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
var conversion = GroupdocsConversion.Instance();
var convertResult = conversion.Convert("@/App_Data/sample.pdf", “converted\converted.jpg”, FileType.Jpg);
if (convertResult.Result)
{
// file is converted and can be downloaded
Download(convertResult.ConvertedFileName);
}
return View();
}
public ActionResult About()
{
ViewBag.Message = “Your application description page.”;
return View();
}
private void Download(string outputFileName)
{
FileType fileType;
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.ClearContent();
response.Clear();
String extension = Path.GetExtension(outputFileName);
if (extension != null && Enum.TryParse(extension.Remove(0, 1), true, out fileType))
{ response.ContentType = Groupdocs.Utils.MimeTypeMapper.Map(fileType); }
response.AddHeader(“Content-Disposition”, “attachment; filename=”" + Path.GetFileName(outputFileName) + “”");
response.TransmitFile(outputFileName);
response.Flush();
response.End();
}
public ActionResult Contact()
{
ViewBag.Message = “Your contact page.”;
return View();
}
}
}