在新标签页C#中打开PDF [英] open PDF in new tab C#
本文介绍了在新标签页C#中打开PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在网络上显示PDF文件时在新选项卡中打开它.但不必单击仅在新选项卡中打开文件的功能.这是我的显示功能:
i want to open the PDF file in new tab when i display it on the web. but without clicking just a function that open the file in a new tab. this is my display function:
private void DisplayPage()
{
string path = CanvasWritingStepImages._pdfName;
WebClient client = new WebClient();
Byte[] buffer = client.DownloadData(path);
if (buffer != null)
{
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "inline; filename=Formulike.pdf");
Response.AddHeader("content-length", buffer.Length.ToString());
Response.BinaryWrite(buffer);
}
else
{
logger.Error("Buffer was Null!");
throw new Exception("PDF ERROR");
}
}
我正在使用"iTextSharp"来处理PDF文件.重要的是,PDF文件将在新选项卡上打开,而无需仅单击该功能即可单击.我刚刚发现点击按钮打开了一个新标签.
i'm using "iTextSharp" to work with the PDF file. it's important that the PDF file will be open on a new tab without any clicking just by the function. i just found with button click that open a new tab.
查看全文