Reputation: 11
I have this function named StampaSingola:
Private Sub StampaSingola()
Dim rpt As New rptLettera
CType(rpt.DataSource, SqlDBDataSource).SQL = "Select * from vwLettere WHERE IdLettera IN (" & Request.QueryString("IdLettera") & ")"
rpt.Run(False)
If Not rpt Is Nothing Then
Dim exp As New PdfExport
' Create a new memory stream that will hold the pdf output
Dim memStream As New System.IO.MemoryStream
' Export the report to PDF:
exp.Export(rpt.Document, memStream)
exp.Dispose()
exp = Nothing
With Me.Context.Response
.Buffer = True
.ContentType = "application/pdf"
.AddHeader("content-disposition", "attachment; filename=Archilet_Lettera_" & Request.QueryString("IdLettera") & ".pdf;")
.BinaryWrite(memStream.ToArray)
.Flush()
.End()
End With
rpt.Document.Dispose()
rpt.Dispose()
rpt = Nothing
End If
End Sub
How do I make open the pdf in a new browser tab? Thank you
Upvotes: 1
Views: 386
Reputation: 1255
protected void btnDownload_Click(object sender, EventArgs e) { Response.Write(string.Format("window.open('{0}','_blank');", "download.aspx")); }
Upvotes: 1