string _imgpath1 = WebConfigurationManager.AppSettings["IMGPATH1"].ToString();

 string outputPath = Server.MapPath(Request.ApplicationPath + "/output");
string file = Guid.NewGuid().ToString() + ".pdf";
string desFile = Path.Combine(outputPath, file); string relativepath = "output/" + file; //转义
//System.Text.Encoding gb2312 = System.Text.Encoding.GetEncoding("gb2312");
//string encodeFilePath = _imgpath1 + HttpUtility.UrlEncode(_imgpath2 + genre, gb2312).Replace("%2f", "/").Replace("%5c", "/").Replace("+", "%20"); private void DownloadFile(string userName, string password, string ftpSourceFilePath, string localDestinationFilePath)
{
int bytesRead = ;
byte[] buffer = new byte[]; FtpWebRequest request = CreateFtpWebRequest(ftpSourceFilePath, userName, password, true);
request.Method = WebRequestMethods.Ftp.DownloadFile; Stream reader = request.GetResponse().GetResponseStream();
FileStream fileStream = new FileStream(localDestinationFilePath, FileMode.Create); while (true)
{
bytesRead = reader.Read(buffer, , buffer.Length); if (bytesRead == )
break; fileStream.Write(buffer, , bytesRead);
}
fileStream.Close();
}
private FtpWebRequest CreateFtpWebRequest(string ftpDirectoryPath, string userName, string password, bool keepAlive = false)
{
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(new Uri(ftpDirectoryPath)); //Set proxy to null. Under current configuration if this option is not set then the proxy that is used will get an html response from the web content gateway (firewall monitoring system)
request.Proxy = null; request.UsePassive = true;
request.UseBinary = true;
request.KeepAlive = keepAlive; request.Credentials = new NetworkCredential(userName, password); return request;
} try
{
string template = Server.MapPath(Request.ApplicationPath + "/reporttemplate/国有土地使用证.mrt");
string outputPath = Server.MapPath(Request.ApplicationPath + "/output");
//删除过期的临时PDF文件
List<FileInfo> toDeleteFiles = new List<FileInfo>();
Directory.GetFiles(outputPath, "*.pdf").ToList().ForEach(i => {
if ((new FileInfo(i)).CreationTime < DateTime.Now)
toDeleteFiles.Add(new FileInfo(i));
});
Task task = new Task(() =>
{
for (int i = toDeleteFiles.Count - ; i >= ; i--)
{ toDeleteFiles[i].Delete(); }
});
task.Start(); StiReport report = new StiReport();
report.Load(template);
report.RegBusinessObject("land", "cer", cer);
report.Compile();
report.Render(true);
string file = Guid.NewGuid().ToString() + ".pdf";
string relativepath = "/output/" + file;
string fullpath = Path.Combine(outputPath, file);
report.ExportDocument(StiExportFormat.Pdf, fullpath); return View(new PdfEntity() { Filename = fullpath, RelativeFilename = relativepath });
}
catch (Exception ex)
{
return View("Error", new HandleErrorInfo(ex, "CerController转换为PDF文件时发生异常", "Index"));
}
@model LandRegQueryWeb.Models.PdfEntity
@{
Layout = null;
} <html>
<body style="background-color: rgb(38,38,38); height: 100%; width: 100%; overflow: hidden; margin: 0"> <embed width="100%" height="100%"
name="plugin" id="plugin"
src="@Model.Filename#toolbar=0&navpanes=0&scrollbar=0"
type="application/pdf" internalinstanceid="" title=""> </body>
</html>

backup1的更多相关文章

  1. backup1:开始数据库备份

    数据库备份分为数据文件备份和日志文件备份,数据文件的备份分为:完整备份和差异备份.在SQL Server 2012中,能够将数据分布式备份到不同的存储设备上,一般情况,只将数据备份到一个备份文件(.b ...

  2. 工行ICBC_WAPB_B2C支付接口

    一. 前期准备 手机银行(WAP)B2C在线支付接口说明V1.0.0.6.doc 手机银行移动生活商户及门户网站js接口API.doc 支付组件ICBCEBankUtil.dll和infosecapi ...

  3. ngx_http_upstream_module模块.md

    ngx_http_upstream_module ngx_http_upstream_module模块用于定义可由proxy_pass,fastcgi_pass,uwsgi_pass,scgi_pas ...

  4. Linux下部署docker记录(1)-Volume使用

    之前部署了Linux下部署docker记录(0)-基础环境安装,接下来看看Docker Volume的使用. Docker volume使用1)一个数据卷是一个特别指定的目录,该目录利用容器的UFS文 ...

  5. Linux下不同服务器间数据传输--转载

    因为工作原因,需要经常在不同的服务器见进行文件传输,特别是大文件的传输,因此对linux下不同服务器间数据传输命令和工具进行了研究和总结.主要是rcp,scp,rsync,ftp,sftp,lftp, ...

  6. Linux下不同服务器间数据传输

    因为工作原因,需要经常在不同的服务器见进行文件传输,特别是大文件的传输,因此对linux下不同服务器间数据传输命令和工具进行了研究和总结.主要是rcp,scp,rsync,ftp,sftp,lftp, ...

  7. RMAN备份与恢复之初入茅庐

    理解数据库备份 所谓备份实际上是把数据库复制到转储设备的过程. 从备份方式来看数据库备份分为物理备份和逻辑备份,物理备份是把构成数据库的所有文件拷贝到指定的位置的过程,而逻辑备份只是利用SQL语言从数 ...

  8. nginx的反向代理和负载均衡的一个总结

    之前一直觉的nginx的反向代理和负载均衡很厉害的样子,最近有机会接触了一下公司的这方面的技术,发现技术就是一张窗户纸呀,捅破了啥都明白了! 接下来先看一下nginx的反向代理: 简单的来说就是ngi ...

  9. linux下不同服务器间数据传输(rcp,scp,rsync,ftp,sftp,lftp,wget,curl)(zz)

    linux下不同服务器间数据传输(rcp,scp,rsync,ftp,sftp,lftp,wget,curl) 分类: linux2011-10-10 13:21 8773人阅读 评论(1) 收藏 举 ...

随机推荐

  1. Linux运维入门到高级全套常用要点

    Linux运维入门到高级全套常用要点 目 录 1. Linux 入门篇................................................................. ...

  2. squid源码安装下的conf文件默认值和提示

    #    WELCOME TO SQUID 3.0.STABLE26#    ----------------------------##    This is the default Squid c ...

  3. error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

    以前一直用的VC6.0,最近换成VS2010了.哎这几天光折腾VS2010了. 曾经我以为程序没啥头绪忒头疼,现在觉得乱七八糟的编译问题才叫一个头裂=口= 原因:VC6.0中,如果没有直接显示指定的返 ...

  4. easycwmp的交叉编译

    原创作品,转载请注明出处 copyright:weishusheng   2015.3.18 email:642613208@qq.com 平台: Linux version 2.6.32-279.e ...

  5. SQL Server常用的性能诊断语句

    /* 常规服务器动态管理对象包括: dm_db_*:数据库和数据库对象 dm_exec_*:执行用户代码和关联的连接 dm_os_*:内存.锁定和时间安排 dm_tran_*:事务和隔离 dm_io_ ...

  6. Beta版本冲刺——day2

    No Bug 031402401鲍亮 031402402曹鑫杰 031402403常松 031402412林淋 031402418汪培侨 031402426许秋鑫 站立式会议 培侨走的第5天,想他~( ...

  7. ecstore-lnmp环境下crontab不执行原因

    因为lnmp.org默认禁止了proc_open函数,需要开启 开启后 lnmp restart ==== contab还是用crontab -e好,有些用www用户的似乎执行不了

  8. [综] Latent Dirichlet Allocation(LDA)主题模型算法

    多项分布 http://szjc.math168.com/book/ebookdetail.aspx?cateid=1&&sectionid=983 二项分布和多项分布 http:// ...

  9. STM32固件库3.5+uCOS2.86移植(转自暴走的工程师)

    考了很多移植的资料和代码,终于移植好了...应该是完美移植吧~~哈哈哈~~ 编译环境是IAR 工程适用于STM32F10X大容量产品,如果不是,请自行修改启动文件和工程配置 编译器优化等级最高...这 ...

  10. python getopt使用

    函数getopt(args, shortopts, longopts = []) 参数args一般是sys.argv[1:] shortopts 短格式 (-) longopts 长格式(--) 命令 ...