现在项目要求将已经做好的asp.net页面生成pdf格式,本来想用免费软件,但是都不成功,现在想用ASPPDF.安装并导入了dll但是运行时却报一个错说是找不到我写转换代码的页面!
代码如下: Dim objPdf As IPdfManager = New PdfManager
Dim objDoc As IPdfDocument = objPdf.CreateDocument(Missing.Value)
// 本来是想将当前页面转成pdf的,但是无论是“http://localhost/AspPDF/WebForm1.aspx”还是“../AspPDF/WebForm1.aspx”都报一个URL错误的异常!
objDoc.ImportFromUrl("http://www.126.com", Missing.Value, Missing.Value, Missing.Value)
Dim strFileName = objDoc.Save(Server.MapPath("printOut.pdf"), False)运行代码异常如下: Server Error in '/AspPDF' Application.
--------------------------------------------------------------------------------The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested Url: /AspPDF/WebForm1.aspx
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407
请大家帮我想想办法,分不够再加!
代码如下: Dim objPdf As IPdfManager = New PdfManager
Dim objDoc As IPdfDocument = objPdf.CreateDocument(Missing.Value)
// 本来是想将当前页面转成pdf的,但是无论是“http://localhost/AspPDF/WebForm1.aspx”还是“../AspPDF/WebForm1.aspx”都报一个URL错误的异常!
objDoc.ImportFromUrl("http://www.126.com", Missing.Value, Missing.Value, Missing.Value)
Dim strFileName = objDoc.Save(Server.MapPath("printOut.pdf"), False)运行代码异常如下: Server Error in '/AspPDF' Application.
--------------------------------------------------------------------------------The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested Url: /AspPDF/WebForm1.aspx
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407
请大家帮我想想办法,分不够再加!
解决方案 »
- GridView
- ASP.NET MVC 如何实现多个表单验证和提交
- 请教 如何设置TABLE中某一个边的颜色
- 接口怎么理解?和类什么区别?举个例子,写几句代码,帮忙理解一下接口!
- 怎么把左边框架页面的值传给右边的框架页面?
- 我是用Response.Redirect("xxxxxxxxxx.aspx")重定向到新的网页。我是想如果该网页不在,如果作出不在的判断...
- 高分求怎么样自动添加图片标记?
- ????怎么我的日期都变成了1905年了啦!!!!!!
- △△△为什么总是取不到菜单? 总是显示catch里面的内容???△△△
- 急!!!如何得到一个用户进入网站的开始时间和离开网站时的时间?
- 存储过程中如何将bit类型转换为int类型或者bit类型如何和1,0进行比较???在线等~
- 求一个验证只能输入0-9|A-Z|a-z|-的正则表达式
Line 38: Dim objDoc As IPdfDocument = objPdf.CreateDocument(Missing.Value)
Line 39:
Line 40: objDoc.ImportFromUrl("http://www.google.com", Missing.Value, Missing.Value, Missing.Value)
Line 41: Dim strFileName = objDoc.Save(Server.MapPath("printOut.pdf"), False)
第40 行 Line 40: objDoc.ImportFromUrl("http://www.google.com", Missing.Value, Missing.Value, Missing.Value) 抛出的异常!
http://blog.csdn.net/KimmKing/archive/2008/01/07/2029351.aspx我的代码报出的异常是:MSXML2::ServerXMLHTTP Error: The attempt to connect to the server failed. 当我将 objDoc.ImportFromUrl()的第一个参数换成本机上的url时,没有异常抛出,但是代码什么都没有做!
不过你转换pdf文件以后为什么会占用很大空间呢?
你可以转换一次,有文件了其他人直接打开这个文件就可以了
abcPdf 价格更贵,客户不能承受。hy_lihuan :不同的人进入到这个页面见到的都是他在前几个页面所填的内容,所以页面是不一样的!而且aspPdf它没生成一次pdf,都保存在本机的硬盘上。如果有很多人访问这个页面,将生成很多的pdf文件!
现在我可以将实现直接打开或者下载的功能。但是在真正的项目中产生的pdf不是页面的内容,而是:
System has got an error message.
System error encountered. Please contact your System Administrator.我看了AspPDF 的manual http://www.asppdf.com/manual_13.html 和例子。
可能是我英语太差,还是没有发现解决的办法。
我想知道ImportFromUrl()对页面的要求。
是不是ImportFromUrl 不能转换含有用户控件的页面?