Simple MVC project

Hello.
Maybe you any MVC APS code sample (not a part). How to convert DOCX to PDF using Document.
For example 2 buttons only:

  1. Load DOCX (from my PC)
  2. Save/Download the result (as a pdf).

Thanks

To convert DOCX to PDF just use DocumentModel.Load and DocumentModel.Save methods, like this:

DocumentModel document = DocumentModel.Load("Input.docx");
document.Save("Output.pdf");

For an ASP.NET MVC application, here is an example of what you can do:

[HttpPost]
public FileResult Download(FileModel model)
{
    var docxPath = Server.MapPath("~/App_Data/Input.docx");
    var document = DocumentModel.Load(docxPath);

    var pdfStream = new MemoryStream();
    var pdfOptions = SaveOptions.PdfDefault;
    document.Save(pdfStream, pdfOptions);

    return File(pdfStream.ToArray(), pdfOptions.ContentType, "Output.pdf");
}

I hope this helps.

Regards,
Mario