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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to export the Chart to PDF

Thread ID:





98400 Feb 24,2011 09:56 PM UTC Feb 28,2011 04:59 AM UTC ASP.NET Web Forms (Classic) 4
Tags: Chart
victor elizondo
Asked On February 24, 2011 09:56 PM UTC

Hi guys

I just want to know "How to export a Chart to PDF?". I'm on Visual Basic .Net in C# and I'm using Syncfusion Essential Studio Before of typing this, I tried to find out this theme in the Syncfusion forums, but the links with related information were broken.

Best Regards.

victor elizondo
Replied On February 24, 2011 11:37 PM UTC

I have the code to xport Charts to PDF and it works fine ( this code below the black line), but I still need a lot the help from all of you. I've generated a PDF file with the chart that I have. I need to add to this PDF file a DataTable ( I will worry about this point later, however a little help it's welcome), but mainly I need to know how to make the size of the chart in the PDF a little bit tiny (I want to resize the chart in the PDF) and also add some text to this PDF file.

Besr regards.

using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;

string fileName = @"C:\Users\Victor\Desktop\chartexport";
string exportFileName = fileName + ".pdf";
string file = fileName + ".jpg";

//Create a PDF document
PdfDocument pdfDoc = new PdfDocument();

//Add a page to the empty PDF document

//Draw chart image in the first page
pdfDoc.Pages[0].Graphics.DrawImage(Syncfusion.Pdf.Graphics.PdfImage.FromFile(file), new PointF(10, 30));

//Save the PDF Document to disk.

// Launches the file.

Geetha M [Syncfusion]
Replied On February 25, 2011 07:08 AM UTC

Hi Victor,

Thank you for your interest in Syncfusion products.

You can specify the size to which you want to reduce the image as shown in the following code snippet.

pdfDoc.Pages[0].Graphics.DrawImage(Syncfusion.Pdf.Graphics.PdfImage.FromFile(file), new PointF(10, 30), new SizeF(100, 100));

// Write text to the top of the page
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 10f);
pdfDoc.Pages[0].Graphics.DrawString("Chart exported to PDF", font, PdfBrushes.Black, new PointF(10, 10));

Also, above code snippet shows how to add text to the PDF page.

Please try this and let us know if you have any questions.


victor elizondo
Replied On February 25, 2011 04:28 PM UTC

Hi Geetha

It works perfectly. A lot of thanks.

Now I will try to research about adding a DATASET into a PDF File. If I don't succeded, I'll be here again.


Geetha M [Syncfusion]
Replied On February 28, 2011 04:59 AM UTC

Hi Victor,

Thank you for the update.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon