In my Visual Studio 2010 MVC 3 app I am trying to use Syncfusion to take a Word document on disk, convert it to a Pdf and display the Pdf in the browser. I'm following the online sample at
http://mvc.syncfusion.com/sfreportingmvcsamplebrowser/MVC/9.3.0.61/DocIO_MVC/Samples/4.0/ImportandExport/DOCtoPDF, which returns a PdfResult from the controller. Here is my simplified controller code, with my message continuing below it:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.Pdf;
using Syncfusion.DocToPDFConverter;
namespace DGPGMWeb.Controllers
{
public class ViewPdfController : Controller
{
public ActionResult ShowPdf()
{
FileStream stream = new FileStream("myfile.doc", FileMode.Open);
WordDocument doc = new WordDocument(stream);
DocToPDFConverter pdfconverter = new DocToPDFConverter();
PdfDocument pdfDoc = new PdfDocument();
pdfDoc = pdfconverter.ConvertToPDF(doc);
return new PdfResult(pdfDoc, "purchreq.pdf", HttpContext.ApplicationInstance.Response, Syncfusion.Pdf.HttpReadType.Open);
}
}
}
----------------
My project uses Syncfusion.Pdf.Mvc since Syncfusion.Pdf.Base does not include PdfResult. VS throws a compiler error on the line
pdfDoc = pdfconverter.ConvertToPDF(doc);
"Cannot implicitly convert type 'Syncfusion.Pdf.PdfDocument' to 'Syncfusion.Pdf.PdfDocument [c:\Program Files (x86)\Syncfusion\Essential Studio\9.3.0.61\Assemblies\3.5\Syncfusion.Pdf.Mvc.dll]'"
I think DocToPDFConverter wants a PDFDocument class from the .Base assembly. If I also reference .Base in the project, I get the error
"The type 'Syncfusion.Pdf.PdfDocument' exists in both 'C:\Program Files (x86)\Syncfusion\Essential Studio\9.3.0.61\assemblies\3.5\Syncfusion.Pdf.Mvc.dll' and 'C:\Program Files (x86)\Syncfusion\Essential Studio\9.3.0.61\assemblies\3.5\Syncfusion.Pdf.Base.dll'"
Any ideas on how to get this to work?