Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: .NET3.5 ASP.NET PDF Chart
Hey I was wondering if anybody knew how to save charts as an image, preferrable pdf. I have a chart dynamically created and have tried a couple things including the following.
protected void btnSaveImage_Click(object sender, EventArgs e)
            chrAdvertising.SaveImage( chrAdvertising.CurrentImageLocation, ChartImageFormat.Png);
            CommonHelper.WriteResponseImage(Server.MapPath("~/TempImages/" + chrAdvertising.CurrentImageLocation), "defaultName.png");
With chart code starting as
<asp:Chart ID="chrAdvertising" runat="server" BackColor="211, 223, 240" ImageUrl="~/TempImages/ChartPic_#SEQ(300,3)"

Where chrAdvertising is the name of the chart and commonhelper.writeResponseImage brings up a window directing the user to where you can save the image (which works with other images already on the server). The problem is the image isn't acutally stored in the TempFolder I assigned it. If you have a better understanding of the chart feature and where the image is stored between postbacks or if it is lost between postbacks, please explain.

Also if you know how to convert the image to pdf that would save me from asking a seperate question Smile | :)
Thanks ~MJ
Posted 16-Sep-11 11:49am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


What you want to do exactly.

You've image and then you've write it in pdf file right.

you can write any thing in pdf files in by using iTextSharp library

If you don't've idea on iTextSharp checkout links for sample codes.

and there is a open source pdf library for

checkout those two links you can get clear idea on handling pdf files in

you can add text,image and charts to PDF file.

Here you are using some tempfolder for saving charts right its better to use session variable or application variable for storing charts

It can easy accessable and easily deletable.

try steps mentioned in above links you'll get good output.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 490
1 Sergey Alexandrovich Kryukov 405
2 Maciej Los 285
3 ProgramFOX 265
4 Peter Leow 210
0 OriginalGriff 490
1 Sergey Alexandrovich Kryukov 395
2 Maciej Los 285
3 ProgramFOX 265
4 CHill60 200

Advertise | Privacy | Mobile
Web04 | 2.8.150331.1 | Last Updated 16 Sep 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100