Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
195
export to pdf file
posted

Hi;

 I am writing the following code to export my chart to a pdf file, the problem is once it executes to the line:

               this.ultraChart1.RenderPdfFriendlyGraphics(g);

 It stucks, and can not continue, can u help me figure out which part is wrong?

thanks ...

 

The codes are the following, ultrabutton1 is for pdf file export:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using Infragistics.Documents.Report;

 

private void ultraButton1_Click(object sender, EventArgs e)

{


//Create a new report
Infragistics.Documents.Report.Report r =
  new Infragistics.Documents.Report.Report();

Graphics g = r.AddSection().AddCanvas().CreateGraphics();
ultraChart1.RenderPdfFriendlyGraphics(g);

//Define a string that contains the path to
// the current user's My Documents folder.


string myDocuments =
  System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);

// Publish the report to the current user's
// My Documents folder with the name of Report.pdf.


r.Publish(myDocuments + "\\Report.pdf", FileFormat.PDF);

}