public void SaveToPDF<TModel>(List<TModel> model, string content, string saveFilePath) { if (model == null) return; Report report = new Report(); report.LoadFromString(content); FillReport(report, model, "print"); //运行报表 report.Prepare(); PDFExport export = new PDFExport(); report.Export(export, saveFilePath); report.Dispose(); } /// <summary> /// 文件转换二进制数据(用于保存数据库) /// </summary> /// <param name="filePath">文件路径</param> /// <returns>二进制</returns> public byte[] FileConvertByte(string filePath) { if (!File.Exists(filePath)) { return null; } byte[] bytContent = null; System.IO.FileStream fs = null; System.IO.BinaryReader br = null; try { fs = new FileStream(filePath, System.IO.FileMode.Open); br = new BinaryReader((Stream)fs); bytContent = br.ReadBytes((Int32)fs.Length); fs.Close(); br.Close(); } catch { fs.Close(); br.Close(); return null; } return bytContent; }