Printing Graph from a Web Project
Posted: Tue Jun 01, 2010 11:13 am
I am trying to give a user the option to print a graph on a web page, and I get a 'No Printers are installed' error, my pc does have printers installed though?
Load graph
Dim ch1 As Steema.TeeChart.Chart = WebChart1.Chart
Dim tmpChart As New MemoryStream()
Print Graph Button
Dim tmpChart As New MemoryStream()
If IsNothing(Session("ch1")) Then
Else
'retrieve the session stored Chart
tmpChart = DirectCast(Session("ch1"), MemoryStream)
'set the Stream position to 0 as the last read/write
'will have moved the position to the end of the stream
tmpChart.Position = 0
'import saved Chart
WebChart1.Chart.Import.Template.Load(tmpChart)
WebChart1.Chart.Printer.Landscape = True
WebChart1.Chart.Printer.Grayscale = True
WebChart1.Chart.Printer.BeginPrint()
WebChart1.Chart.Printer.Print(WebChart1.Chart, New Rectangle(50, 10, 1100, 800))
WebChart1.Chart.Printer.EndPrint()
End If
Above is my code snippet from my Print Graph button - Any ideas would be appreciated
Load graph
Dim ch1 As Steema.TeeChart.Chart = WebChart1.Chart
Dim tmpChart As New MemoryStream()
Print Graph Button
Dim tmpChart As New MemoryStream()
If IsNothing(Session("ch1")) Then
Else
'retrieve the session stored Chart
tmpChart = DirectCast(Session("ch1"), MemoryStream)
'set the Stream position to 0 as the last read/write
'will have moved the position to the end of the stream
tmpChart.Position = 0
'import saved Chart
WebChart1.Chart.Import.Template.Load(tmpChart)
WebChart1.Chart.Printer.Landscape = True
WebChart1.Chart.Printer.Grayscale = True
WebChart1.Chart.Printer.BeginPrint()
WebChart1.Chart.Printer.Print(WebChart1.Chart, New Rectangle(50, 10, 1100, 800))
WebChart1.Chart.Printer.EndPrint()
End If
Above is my code snippet from my Print Graph button - Any ideas would be appreciated