How to return PDF to browser in MVC?
问题 I have this demo code for iTextSharp Document document = new Document(); try { PdfWriter.GetInstance(document, new FileStream(\"Chap0101.pdf\", FileMode.Create)); document.Open(); document.Add(new Paragraph(\"Hello World\")); } catch (DocumentException de) { Console.Error.WriteLine(de.Message); } catch (IOException ioe) { Console.Error.WriteLine(ioe.Message); } document.Close(); How do I get the controller to return the pdf document to the browser? EDIT: Running this code does open Acrobat