NetCharts® Server: ASP.NET Toolkit retrievePDF Example using Visual Basic
This example shows how to utilize the NetCharts Server ASP.NET Toolkit to retrieve a a generated report as PDF from NetCharts Server using Visual Basic.
Source Code
Public Class retrievePDF
Inherits System.Web.UI.Page#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()End Sub
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.ObjectPrivate Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim serverName As String = ConfigurationSettings.AppSettings("serverName")
Dim serverPort As Integer = CType(ConfigurationSettings.AppSettings("serverPort"), Integer)
Dim toolKit As NetChartsServer.NSToolKit = New NetChartsServer.NSToolKit("Examples/Finance", serverName, serverPort)
Dim ht As Hashtable = New Hashtable
ht.Add("type", "PDF")' Set the appropriate content type.
Response.ContentType = "Application/pdf"
' Set the header to instruct the browser as to the file name.
Response.AddHeader("Content-Disposition", "inline; filename=report.pdf")
' Write the file directly to the HTTP output stream.
Response.BinaryWrite(toolKit.getPDFReport("Costs.pgl", ht))
Response.End()
End SubEnd Class
![]()



