We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Display PDF in browser

Thread ID:





100818 Sep 7,2011 06:42 PM UTC Sep 9,2011 04:24 AM UTC ASP.NET Web Forms (Classic) 5
Tags: PDF
Administrator [Syncfusion]
Asked On September 7, 2011 06:42 PM UTC

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/, 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\\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\\assemblies\3.5\Syncfusion.Pdf.Mvc.dll' and 'C:\Program Files (x86)\Syncfusion\Essential Studio\\assemblies\3.5\Syncfusion.Pdf.Base.dll'"

Any ideas on how to get this to work?

Geetha M [Syncfusion]
Replied On September 8, 2011 12:14 PM UTC

Hi Jim,

Thank you for your interest in Syncfusion products.

DocToPDFConverter depends on Pdf.Base assembly. Could you please have Pdf.Base as reference instead of Pdf.MVC and make use of the PdfResult Extension classes in the sample application attached here to stream the output document to client?


Please let me know if you have any questions.


Administrator [Syncfusion]
Replied On September 8, 2011 04:55 PM UTC

Thanks! That worked perfectly.

Administrator [Syncfusion]
Replied On September 8, 2011 07:23 PM UTC

One more question - Do you know any way to get the pdf to open in a new window rather than replacing the current view?

Administrator [Syncfusion]
Replied On September 8, 2011 09:49 PM UTC

Never mind, I was being stupid. Just needed to set the submit target to "_blank".

Thanks for your help, I love your product!

Geetha M [Syncfusion]
Replied On September 9, 2011 04:24 AM UTC

Hi Jim,

Thank you for the update.

Please let us know if you have any further questions.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon