| 123456789101112131415161718192021222324252627282930313233 |
- using Core.Mes.Client.Comm.Server;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Text;
- namespace Core.Mes.Client.Comm.Tool
- {
- public class ReportHelper
- {
- /// <summary>
- /// 把报表转换为PDF并上传到FTP服务器
- /// </summary>
- /// <param name="url">报表地址</param>
- /// <param name="ftpPath">FTP服务器相对路径 Qcm/Craft/</param>
- /// <param name="pdfName">PDF名称</param>
- /// <returns></returns>
- public static bool CreatePdfToFtp(string url, string ftpPath, string pdfName)
- {
- WebClient webClient = new WebClient();
- List<FileBean> listPdf = new List<FileBean>();
- byte[] pdf = webClient.DownloadData(url + "&format=pdf");
- FileBean fileBean = new FileBean();
- fileBean.setFile(pdf);
- fileBean.setFileName(pdfName + ".pdf");
- fileBean.setPathName(ftpPath);
- listPdf.Add(fileBean);
- webClient.Dispose();
- return FileHelper.Upload(listPdf);
- }
- }
- }
|