Could anyone please tell me how could I stream a pdf to a new tab browser? I just have the pdf stream on memory and I want when I click over the link to show the PDF in a new tab or window browser.
How could I do that?
Thank!!!
I have this link:
<a id="hrefPdf" runat="server" href="#" target="_blank"><asp:Literal ID="PdfName" runat="server"></asp:Literal></a>
In my code behind I have this on the onload event:
Stream pdf= getPdf
if (pdf != null)
{
SetLinkPDF(pdf);
}
private void SetLinkPDF(IFile pdf)
{
hrefPdf.href = "MyPDF to the Browser"
PdfName.Text = pdf.PdfName;
}
Someway I have to process the stream pdf (IFile contains Name, Stream,Metadata, etc of the PDF)
What can I do to proccess this and whe I click show the stream at a new browser?
I have another probelm, is not working the OnClientClick="aspnetForm.target='_blank';" timbck2 suggested me. I have to open the file (image or pdf ) in a new window, what could I do? Is not working this. Thank!
Timbbck2 my asp code is:
<asp:LinkButton runat="server" ID="LinkButtonFile" OnClick="LinkButtonFile_Click" OnClientClick="aspnetForm.target = '_blank';"></asp:LinkButton>
Thanks!!!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…