0
我正在使用Asp.Net MVC,并且我构建了一个返回pdf文件的控制器。 我建有PdfSharp的PDF:Asp.net mvc ajax用参数打开pdf
public ActionResult GenerateReport(string Param)
{
// Create a new PDF document
PdfDocument document = new PdfDocument();
document.Info.Title = "Created with PDFsharp";
// Create an empty page
PdfPage page = document.AddPage();
// Get an XGraphics object for drawing
XGraphics gfx = XGraphics.FromPdfPage(page);
// Create a font
XFont font = new XFont("Verdana", 20, XFontStyle.BoldItalic);
// Draw the text
gfx.DrawString("Hello, World!", font, XBrushes.Black,
new XRect(0, 0, page.Width, page.Height),
XStringFormats.Center);
MemoryStream stream = new MemoryStream();
document.Save(stream, false);
byte[] bytes = stream.ToArray();
return File(bytes, "application/pdf");
}
现在我的目标是从jQuery的发送一个AJAX请求,并在新标签中打开PDF文件。除此之外,我想将参数传递给控制器。
在此先感谢!
大解决方法:) – Anokrize