网站建设 郑州网站建设 网站制作 网页设计 网站设计 郑州建网站 - 爱易在线

网站地图 | 网站Tags标签 | RSS订阅 | 加入收藏
您的位置:网站首页 > 博客笔记 > 技术交流 > 正文 技术交流相关信息

asp生成在线PDF文档

作者:郑州网站建设 2012/8/27 10:47:34 点击: 来源:

asp生成在线pdf文档

Call AspGetPdf("http://www.baidu.com/index.html","index.pdf")
Public Function AspGetPdf(UrlString,FileNameString)
         On Error Resume Next
         UrlString = Trim(UrlString)
         FileNameString = Trim(FileNameString)
         UrlString = Cstr(UrlString)
         FileNameString = Cstr(FileNameString)

         Call GetFileExist(FileNameString)

         If InStr(LCase(UrlString),"http://")=0 Then
             Exit Function
         End If
         If FileNameString="" Then
             Exit Function
         End If
         Set Pdf = Server.CreateObject("Persits.Pdf")
         '注册
         Pdf.RegKey = "IWeziEHrQRW3UWWnQYM7k6Bv1Aokiw+v+T5aROrwosAyGs+y/JiyaZijMI0BGarE90IyhQYF2SmG"
         '查看本组件到期时间
         'Response.Write Pdf.Expires
         'PDF文档设置
         Set Doc = Pdf.CreateDocument
         Doc.Title = "Title" '标题
         Doc.Creator = "Creator" '创建者
         Doc.Subject = "NewsSubject" '主题
         Doc.Author = "Author" '作者
         Doc.Keywords = "KeyWords" '关键词
         Doc.Producer = "Producer" '制作者
         'Doc.CreationDate = "2009-8-8" '创建时间
         'Doc.ModDate = "2009-8-9" '修改时间
         'Set Doc = Pdf.CreateDocument
         '将网页生成PDF,不支持中文
         Doc.ImportFromUrl UrlString,"landscape=true"
         Filename = Doc.Save( Server.MapPath(FileNameString), False )

         If Err<>0 Then
             Response.Write("报错:请自行检查!")
         End If
End Function

Public Function GetFileExist(FileNameString)
     On Error Resume Next
     Dim FilePath
     FilePath = Server.Mappath(FileNameString)
     Set Fso = Server.CreateObject("Scripting.FileSystemObject")
     If Fso.FileExists(FilePath) = true then
         Fso.DeleteFile(FilePath)
     End If
     If Err<>0 Then
         Response.Write("报错:请自行检查!")
     End If
End Function

Tag:asp pdf
分享到:

上一篇:IE8不支持eWebEditor在线文本编辑器的解决办法

下一篇:sdcms1.3.1调用两个大类下全部小类的所有文章

技术交流推荐阅读

用户评论

最新博文

热门排行

推荐信息

关于爱之易| 付款方式| 联系我们| 网站地图| 网站Tags标签 | RSS订阅