Microsoft图表,另存为pdf [英] Microsoft Charts, Save to pdf

查看:109
本文介绍了Microsoft图表,另存为pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我想知道是否有人知道如何将图表保存为图像,最好是pdf.我有一个动态创建的图表,并尝试了一些操作,包括以下内容.

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");
        }


<asp:Chart ID="chrAdvertising" runat="server" BackColor="211, 223, 240" ImageUrl="~/TempImages/ChartPic_#SEQ(300,3)"


开始的asp.net图表代码
其中chrAdvertising是图表的名称,commonhelper.writeResponseImage会弹出一个窗口,将用户定向到您可以保存图像的位置(该位置可与服务器上已有的其他图像一起使用).问题是该图像没有被强制存储在我为其分配的TempFolder中.如果您对图表功能以及在回发之间存储图像的位置有更好的了解,或者在回发之间丢失了图像,请进行解释.

另外,如果您知道如何将图像转换为pdf,这将使我免于询问另一个问题:)
谢谢〜MJ



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 :)
Thanks ~MJ

推荐答案


您要确切执行的操作.

您先获得图像,然后就将其写入pdf文件中.

您可以使用 iTextSharp 库在asp.net的pdf文件中写任何东西

如果您不了解iTextSharp结帐链接以获取示例代码.

http://www.developerfusion.com/code/5682/create -pdf-files-on-fly-in-c/

而且有一个用于asp.net的开源pdf库

http://www.webresourcesdepot.com/open-source-pdf-library-for -aspnet-pdfsharp/

检出这两个链接,您可以清楚地了解如何在asp.net中处理pdf文件

您可以将文本,图像和图表添加到PDF文件.

在这里,您正在使用一些临时文件夹来保存图表,最好使用会话变量或应用程序变量来存储图表

它可以轻松访问和轻松删除.


试试上面链接中提到的步骤,您将获得良好的输出.
Hi
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 asp.net by using iTextSharp library

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

http://www.developerfusion.com/code/5682/create-pdf-files-on-fly-in-c/

and there is a open source pdf library for asp.net

http://www.webresourcesdepot.com/open-source-pdf-library-for-aspnet-pdfsharp/

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

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.


这篇关于Microsoft图表,另存为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆