<%@ 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 = " 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>