Printing Graph from a Web Project

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
JF_3D
Newbie
Newbie
Posts: 5
Joined: Thu Apr 15, 2010 12:00 am

Printing Graph from a Web Project

Post by JF_3D » 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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Printing Graph from a Web Project

Post by Narcís » Tue Jun 01, 2010 1:33 pm

Hi JF_3D,

What about doing as discussed here?

Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

JF_3D
Newbie
Newbie
Posts: 5
Joined: Thu Apr 15, 2010 12:00 am

Re: Printing Graph from a Web Project

Post by JF_3D » Fri Jun 04, 2010 10:55 am

Thanks for advice, I am new to this, I have added Javascript at the beginning of my Source, but when I add printpage() to my button click I get the error 'printpage' is not a member of 'ASP.webiss_graph_history_aspx'.

This is my button code

<td style="width: 445px; height: 8px; text-align: center">
<asp:Button ID="btnPrint" runat="server" BackColor="#C0FFC0" Height="32px" OnClick="printpage()"
Text="Print Graph" ToolTip="Print Graph" /></td>


This is what I added at the top

<script language="Javascript1.2">
function printpage() {
window.print();
}
</script>

JF_3D
Newbie
Newbie
Posts: 5
Joined: Thu Apr 15, 2010 12:00 am

Re: Printing Graph from a Web Project

Post by JF_3D » Mon Jun 07, 2010 3:37 pm

OK, I managed to print using the onClientClick from your example.

The problem I have is - I only want the graph to print - not the whole screen

Please help :(

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Printing Graph from a Web Project

Post by Yeray » Tue Jun 08, 2010 8:09 am

Hi JF_3D,

Could you please take a look at here where something similar was discussed?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply