以pdf格式显示报告 [英] Show Report in pdf format

查看:158
本文介绍了以pdf格式显示报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在SQL Server 2008中将报告保存为jpg格式。我想在单击按钮时将报告显示为pdf格式。请帮我。我已经给出了我的代码:

代码用于保存

I save a report as jpg format in SQL server 2008. I want to show the report as pdf format when click a button. Please help me. I have given my code :
code for save

if (picUpload.FileName.ToString() != "")
{
    string StrImgName = picUpload.FileName.ToString();
    string ImgFileExtension = System.IO.Path.GetExtension(StrImgName);
    string picPath = "SCDoc/" + txtSCCode.Text.Trim() + "-P" + ImgFileExtension;
    DRLocal["ContImagePath"] = picPath;
}



节目报告代码


Code for show report

string DocUrl;
getvalue = Request.QueryString["SCCode"].ToString();

DataTable DTLocal;

DTLocal = new DataTable();

ConManager.DBConnection("TERMSCOM");
string strSQL = "SELECT ContImagePath from tblSalesContract where SCCode='" + getvalue + "'";
ConManager.OpenDataTableThroughAdapter(strSQL, out DTLocal, true);
DTLocal.TableName = "Item";
ConManager.CloseConnection();
DocUrl = DTLocal.Rows[0]["ContImagePath"].ToString();
Response.ContentType = "Application/pdf";
Response.WriteFile(Server.MapPath(DocUrl));
Response.End();

推荐答案

I think you will have to convert the image to a PDF before showing it. Google iTextSharp which is a library which will allow you to create PDF. In your case, you will have to temporarily create pdf and show it. OR, for all the images saved, create a pdf and store it on file system and store the path in the database. On button click, show the pdf instead of getting the image path. Hope this helps.

Happy coding..!!


这篇关于以pdf格式显示报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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