We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Print the graphs with additional custom text

Hi,
1/ I need to print the graphics with additional titles and text that explain it.
How can I add this text to the PrintDocument before it is displayed on the PrintPreview Dialog or sent the printer ?
2/ I already have a routine that creates a PrintDocument with the appropriate titles and custom text and that add an image....How can I extract an image of my Syncfusion graph in order to add it to the print document ?
Thank you


7 Replies

VK Vijayabharathi K Syncfusion Team November 29, 2010 11:49 AM UTC

Hi Leila,

Thank you for your interest in Syncfusion products.

1.How can I add this text to the PrintDocument before it is displayed on the PrintPreview Dialog or sent the printer ?

If your intension is to add title and text to chart control, you can refer the following online documentation link mentioned below,

http://help.syncfusion.com/ug_84/User%20Interface/Windows%20Forms/Chart/Documents/multiplecharttitles1.htm

http://help.syncfusion.com/ug_84/User%20Interface/Windows%20Forms/Chart/Documents/custompoints1.htm

If we add the title and text to the chart control, you will be able to print the chart with multiple title and text.

Or, If your intension is to add title and text to PrintDocument, kindly refer to the below code snippet to achieve this,

[VB]

PrintPreviewButton_click Event:

For Each lControl As Control In chartControl1.Controls
If TypeOf (lControl) Is ChartTitle Then
title.Text = "Custom Chart Title" ‘Add title to chart
chartControl1.Titles.Add(title)
End If
Dim lPageSetupDialog1 As New System.Windows.Forms.PageSetupDialog
chartControl1.PrintDocument.PrinterSettings = New Printing.PrinterSettings
lPageSetupDialog1.Document = chartControl1.PrintDocument


2. How can I extract an image of my Syncfusion graph in order to add it to the print document ?

You can use “SaveImage” property of chart to extract the chart image and add it to the print document. kindly refer to the below code snippet to achieve this,

[VB]

Me.chartControl1.SaveImage("chart.jpg")

You can refer the following online documentation link mentioned below,

http://help.syncfusion.com/ug_84/User%20Interface/Windows%20Forms/Chart/Documents/exportingasanimage1.htm

Please let me know if i misunderstood your query, please share us the sample that you pointed out by you in the previous post so that we could analyze the cause of the issue and provide you with a solution?

Regards,
Vijayabharathi K





LB Leïla Benakezouh November 29, 2010 03:21 PM UTC

Hi,
Thank you for your answer.
Maybe I didn't explain my case very well. What I need to do in to encapsulate my graph in a kind of report (by adding a specific title and an explanation of the graphic) when I print it.I don't want to add this custom text on the Graph directly.

In order to achieve that, I will need to manipulate the PrintDocument.PrintPage event and to add the title then the graph and also the text bellow the graph (see the picture attached to the message/The left picture is the expected result).
I'm already able to add the title and the text bellow the graph but my Sycfusion graph is automatically added to the PrintDocument and it fills all the space whereas I want it to occupy a speficic size (see the picture attached to the message/The right picture is the current result).
How can I control the size and location of the graph on the PrintDocument ?



VK Vijayabharathi K Syncfusion Team November 30, 2010 06:29 AM UTC

Hi Leila,

Thanks for the update.

Could you please send us the screen shot for this issue? In the previous post , you have mentioned “see the picture attached to the message” but we are not able to find any attachment in that post.

Regards,
Vijayabharathi K




LB Leïla Benakezouh December 7, 2010 10:52 AM UTC

Sorry, I was working on something else and I forgot to check your post.
Attached to this message you can find a screen shot of the expected result (on the left) and the current one (on the right).



Print Issue_1ec95213.rar


VK Vijayabharathi K Syncfusion Team December 8, 2010 07:18 AM UTC

Hi Leila,

Thanks for update the screen shot.

For this issue, we suggest you to extract the chart control as image and then set the size and print document location of the chart image and add it to the print document in the order(your routine). You do not print the chart control directly in print document.

You can use “SaveImage” property of chart to extract the chart image and add it to the print document. kindly refer to the below code snippet to achieve this,

[VB]

Me.chartControl1.SaveImage("chart.jpg")

You can refer the following online documentation link mentioned below,

http://help.syncfusion.com/ug_84/User%20Interface/Windows%20Forms/Chart/Documents/exportingasanimage1.htm

Thanks for using Syncfusion products.

Regards,
Vijayabharathi K




LB Leïla Benakezouh December 8, 2010 03:05 PM UTC

Hi,

I already thought about this solution that works well but what I don't want to do is to generate a picture and to save it on the disk (on some computers, you can not be allowed to write on the disk)every time the user needs to print a graphic.

Do you really think it is the only solution ?

Thank you.



VK Vijayabharathi K Syncfusion Team December 9, 2010 06:24 AM UTC

Hi Leila,

Thanks for the update.

For this issue, the chart control needs to be saved and then added to the print document. If we save the chart by stream object, we can resolve your issue. But currently, we do not provide support to save the chart image in stream obj. This has been confirmed as a Feature Request.

We will implement this feature in our forthcoming new version releases or service pack releases. The feature implementation
would also greatly depend on the factors such as product design, code compatibility and complexity.
We will get back to you once the feature is implemented.

Could you please open the new incident in Direct-Trac for better follow-up this feature?

Thank you for your interest in Syncfusion products.

Regards,
Vijayabharathi K



Loader.
Live Chat Icon For mobile
Up arrow icon