Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- System.Diagnostics.Process p = new System.Diagnostics.Process();
- p = new System.Diagnostics.Process();
- p.StartInfo.FileName = CreatePDF(); // method that creats my pdf and returns the full path
- try
- {
- if (!p.Start())
- Controller.Error = "Opening acrobat failed..";
- }
- catch(Exception ex)
- {
- Controller.Error = "Create PDF::" + ex.Message;
- }
- Response.ContentType = "application/pdf";
- Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", file.FileName));
- Response.BinaryWrite(file.FileBytes);
- Response.Flush();
- Response.End();
- var stream = GetTheFileAsStream();
- var attachment = new Attachment(stream);
- using (Process p = new Process())
- {
- p.StartInfo.RedirectStandardOutput = false;
- p.StartInfo.FileName = @"C:foo.pdf";
- p.StartInfo.UseShellExecute = true;
- p.Start();
- p.WaitForExit();
- }
- public ActionResult GetFile()
- {
- return File("foo.pdf", "application/pdf");
- }
Add Comment
Please, Sign In to add comment