Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Response.Clear()
- Response.ContentType = result.MimeType 'this is always "application/pdf"
- Response.Cache.SetCacheability(HttpCacheability.Private)
- Response.Expires = -1
- Response.Buffer = True
- Response.AddHeader("Content-Disposition", String.Format("{0};FileName={1}", "attachment", fileName))
- Response.BinaryWrite(result.DocumentBytes)
- Response.End()
- Protected Sub ButtonPDF_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPDF.Click
- DownloadReportPDF(Me.RadGrid1.SelectedValue.ToString())
- Dim strMessage As String = "alert('Printed PDF Sheet.');"
- ScriptManager.RegisterStartupScript(Me, Me.GetType, "MyScript", strMessage, True)
- End Sub
- Protected Sub DownloadReportPDF(ByVal releaseMasterId As String)
- 'Service call to generate report source
- Dim service As New TelerikReportLibrary.ReportServices.PPSReportService
- Dim source As Telerik.Reporting.TypeReportSource = service.GetReportSource(releaseMasterId)
- 'Render PDF and download
- Dim reportProcessor As New ReportProcessor()
- Dim result As RenderingResult = reportProcessor.RenderReport("PDF", source, Nothing)
- Dim fileName As String = result.DocumentName + "_" + releaseMasterId + "." + result.Extension
- Response.Clear()
- Response.ContentType = result.MimeType 'this is always "application/pdf"
- Response.Cache.SetCacheability(HttpCacheability.Private)
- Response.Expires = -1
- Response.Buffer = True
- Response.AddHeader("Content-Disposition", String.Format("{0};FileName={1}", "attachment", fileName))
- Response.BinaryWrite(result.DocumentBytes)
- Response.End()
- End Sub
- <asp:linkButton ID="btnPDF" CssClass="btn btn-default" runat="server" Width="115px">
- <i class="fa fa-file-text" title="Edit"></i> PDF
- </asp:linkButton>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement