如何压缩CrystalReport生成的多个pdf?

时间:2019-08-16 07:18:40

标签: asp.net-mvc-4 crystal-reports

到目前为止,我正在使用Crystal Report以编程方式生成PDF文件,我希望将所有这些PDF压缩,但找不到解释该问题的教程或博客。

到目前为止,我正在这样做::

    //Generate reports
    [HttpPost]
    public ActionResult Generate reports(string[] Param)
    {
        //I create a list where I will store the reports created
        List<ReportDocument> list_temp = new List<ReportDocument>();

        //Here I create the reports and add them to the list
        for (int i = 1; i <= Param.Length - 1; i++)
        {
            DataTable dtInterested = new DataTable();
            dtInterested = TableInterested(getInterested(Param[0], Param[i]));

            ReportClass Report = new ReportClass();
            Report.Load(Path.Combine(Server.MapPath("~/Reports/"), "ReportUser.rpt"));
            Report.SetDataSource(dtInterested);

            list_temp.Add(Report);
        }

        //And here supposedly should be the code of how to compress all those documents, but I don't know the procedure...

        .......

        //Try this but it makes me wrong.
        Stream stream = list_temp.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
        stream.Seek(0, SeekOrigin.Begin);

        return File(stream, "application/zip", "ReportUser.zip"); ;
    }

0 个答案:

没有答案