ASP横向输出和纵向输出PDF
来源:互联网 发布:java 精确毫秒后6位 编辑:程序博客网 时间:2024/05/27 19:26
<%@ language="vbscript" %>
<%
edition=session("edition")
userrole=session("userrole")
projectid=request("projectid")
plantid=request("plantid")
unitid=request("unitid")
unittype=request("unittype")
reportname=request("reportname")
webtype=request("webtype")
reporttype=1
filePath="../mypdfs/"
daytime=year(now())&""&right( "0"&month(now()),2)&""&right( "0"&day(now()),2)&""&right( "0"&hour(now()),2)&""&right( "0"&Minute(now()),2)&""&right( "0"&Second(now()),2)
theURL = "http://localhost/main/"&reportname&".asp?projectid="&projectid&"&plantid="&plantid&"&unitid="&unitid&"&unittype="&unittype&"&reporttype="&reporttype&"&edition="&edition&"&userrole="&userrole
Set theDoc = Server.CreateObject("ABCpdf8.Doc")
'theDoc.SetInfo 0, "License", "XeJREBodo/hWsScFb6HXZNz/eLAdPdtyprr48fbgO1Ygz1Lcdk74ZeFpPk5CxXQFBw=="
theDoc.HtmlOptions.Engine =1
if webtype="2" then
w = theDoc.MediaBox.Width
h = theDoc.MediaBox.Height
l = theDoc.MediaBox.Left
b = theDoc.MediaBox.Bottom
theDoc.Transform.Rotate 90, l, b
theDoc.Transform.Translate w, 0
theDoc.Rect.Width = h
theDoc.Rect.Height = w
theDoc.Rect.Inset 10, 40
theDoc.Page = theDoc.AddPage()
theID = theDoc.AddImageUrl(theURL)
Do
If Not theDoc.Chainable(theID) Then Exit Do
theDoc.Page = theDoc.AddPage()
theID = theDoc.AddImageToChain(theID)
Loop
For i = 1 To theDoc.PageCount
'header
theDoc.Rect = "20 559 228 600" '左下横坐标,纵坐标,右上横坐标,纵坐标
'theDoc.HPos = 0.5
'theDoc.VPos = 0.5
theDoc.Color = "0 0 255"
theDoc.FontSize = 12
strHeaderImage =replace( server.MapPath("ecosystem_big.jpg") ,"main","images")
theDoc.AddImageFile strHeaderImage, 1
'context
theDoc.PageNumber = i
theDoc.Flatten
'footer
theDoc.Rect = "684 20 780 50"
theDoc.Color = "0 0 255"
theDoc.FontSize = 12
strFooterImage =replace( server.MapPath("mcquay-logo-b.jpg") ,"main","images")
theDoc.AddImageFile strFooterImage, 1
Next
'纵向
else
theDoc.Rect.Inset 20, 100
theDoc.Page = theDoc.AddPage()
theID = theDoc.AddImageUrl(theURL)
Do
If Not theDoc.Chainable(theID) Then Exit Do
theDoc.Page = theDoc.AddPage()
theID = theDoc.AddImageToChain(theID)
Loop
For i = 1 To theDoc.PageCount
'header
theDoc.Rect = "20 739 228 780" '左下横坐标,纵坐标,右上横坐标,纵坐标
theDoc.Color = "0 0 255"
theDoc.FontSize = 12
strHeaderImage =replace( server.MapPath("ecosystem_big.jpg") ,"main","images")
theDoc.AddImageFile strHeaderImage, 1
theDoc.PageNumber = i
theDoc.Flatten
'footer
theDoc.Rect = "480 18 580 50"
theDoc.Color = "0 0 255"
theDoc.FontSize = 12
strFooterImage =replace( server.MapPath("mcquay-logo-b.jpg") ,"main","images")
theDoc.AddImageFile strFooterImage, 1
Next
end if
theDoc.Save(Server.MapPath(filePath&daytime&".pdf"))
set theDoc=Nothing
Filename=daytime&".pdf"
strFilename =replace( server.MapPath(replace(replace(Filename,"\",""),"/","")) ,"main","mypdfs")
Response.Buffer = True
Response.Clear
Set s = Server.CreateObject("ADODB.Stream")
s.Open
s.Type = 1
on error resume next
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if not fso.FileExists(strFilename) then
Response.Write("<h1>Error:</h1>"&strFilename&" does not exists!<p>")
Response.End
end if
Set f = fso.GetFile(strFilename)
intFilelength = f.size
s.LoadFromFile(strFilename)
if err then
Response.Write("<h1>Error: </h1>Unknown Error!<p>")
Response.End
end if
Response.AddHeader "Content-Disposition","attachment; filename="&f.name
Response.AddHeader "Content-Length",intFilelength
Response.CharSet = "UTF-8"
Response.ContentType = "application/octet-stream"
Response.BinaryWrite s.Read
Response.Flush
s.Close
Set s = Nothing
%>
<script>
//window.location.href="<%=filePath%><%=daytime%>.pdf"
</script>
- ASP横向输出和纵向输出PDF
- sql server 纵向表横向输出的实现
- 在场景中输出横向或纵向压缩的中文字符
- 在场景中输出横向或纵向压缩的中文字符
- 横向越权和纵向越权
- 纵向拆分和横向拆分
- 输出pdf
- Uboot实现文字纵向输出的原理和实现
- hdu 5092 线裁剪(纵向连线最小和+输出路径)
- 输出PDF文档到ASP.NET页面
- 输出PDF文档到ASP.NET页面
- ArcMap - 横向输出地图
- Java日历横向输出
- Oracle的表结构:纵向和横向
- javascript 横向和纵向滚动效果
- 纵向PNP管和横向PNP管
- C#+ArcEngine打印横向和纵向调整
- Oracle的表结构:纵向和横向
- asp.net使用ado连接数据库
- 1013. 数素数 (20)
- Java代理模式(cglib代理)
- 判断页面是否滚动到底部
- 比较offsetX, pageX,clientX,screenX的区别
- ASP横向输出和纵向输出PDF
- 扩展欧几里德算法 递归和非递归实现及证明
- Arduino教程汇总贴
- Java实现字符串大小写的转换并倒序输出
- 互联网广告系统综述一生态圈
- 前端面试题小探(1)
- 第三方邮箱登录126,163等服务器配置STMP
- 蓝牙串口设置
- 历史上最全面的的Servlet总结