通过Crystal Reports以外的ASP.NET应用程序创建PDF文件需要什么?
答案 0 :(得分:2)
您可以使用iText#,它基于类似的Java项目。
http://itextsharp.sourceforge.net/
您不需要将Crystal Reports与此结合使用。如果你需要更强大(但价格昂贵)的东西,我已经用复杂的PDF来取得巨大成功:
答案 1 :(得分:0)
一个可能的库是iTextSharp。显然iText是一个巨大的交易,但我在使用iTextSharp的要求时并没有真正看到它,但那是几年前。
答案 2 :(得分:0)
最简单的方法是使用第三方库。我过去使用过ASPOSE.PDF并且效果很好。
http://www.aspose.com/categories/file-format-components/aspose.pdf-for-.net-and-java/default.aspx
我也试过它的开源PDF Sharp,但不是那么灵活。
答案 3 :(得分:0)
您有几个开源选项here。
答案 4 :(得分:-2)
protected void btnReport_Click(object sender, EventArgs e)
{
showReport();
}
private void showReport()
{
DataTable dat = Reports.getPartyWiseJobStatusReport(Convert.ToInt16(ddlDivName.SelectedValue), Convert.ToInt16(ddlJobGroup.SelectedValue), Convert.ToInt16(ddlProjectStatus.SelectedValue));
ReportDocument rptdoc = new ReportDocument();
string path = Server.MapPath("~/Reports/rptPartyWiseJobStatus.rpt");
rptdoc.Load(path);
rptdoc.SetDataSource(dat);
//rptdoc.SetParameterValue(0, ddlDivName.SelectedItem.Text);
//ExportOptions exportOpts1 = rptdoc.ExportOptions;
rptdoc.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
rptdoc.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
rptdoc.ExportOptions.DestinationOptions = new DiskFileDestinationOptions();
((DiskFileDestinationOptions)rptdoc.ExportOptions.DestinationOptions).DiskFileName = Server.MapPath("~/Reports/rptPartyWiseJobStatus.pdf");
rptdoc.Export();
rptdoc.Close();
rptdoc.Dispose();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.AppendHeader("Content-Disposition", "attachment; filename=rptPartyWiseJobStatus.pdf");
Response.WriteFile("~/Reports/rptPartyWiseJobStatus.pdf");
Response.Flush();
Response.Close();
File.Delete(Server.MapPath("~/Reports/rptPartyWiseJobStatus.pdf"));
}
public static DataTable getPartyWiseJobStatusReport(Int16 DivisionID,Int16 JobGroup,Int16 ProjectStatus)
{ string _procName =“sp_T_Proposal_SelectPartyWiseJobStatus”;
DataTable dt1 = new DataTable();
Database objDatabase = DatabaseFactory.CreateDatabase();
DbCommand objDbCommand = objDatabase.GetStoredProcCommand(_procName);
objDatabase.AddInParameter(objDbCommand, "@DivisionID", DbType.Int16, DivisionID);
objDatabase.AddInParameter(objDbCommand, "@JobGroup", DbType.Int16, JobGroup);
objDatabase.AddInParameter(objDbCommand, "@ProjectStatus", DbType.Int16, ProjectStatus);
using (IDataReader dr = objDatabase.ExecuteReader(objDbCommand))
{
dt1.Load(dr);
}
return dt1;
}