asp如何生成pdf格式的文件

如题
2024-12-01 17:24:02
推荐回答(3个)
回答1:

原来的是下载DOC文档的一个页面,用的是
Response.Clear
Response.ContentType = "application/pdf"
Response.AddHeader "content-disposition", "attachment; filename=" & FileName
Set Stream = server.CreateObject("ADODB.Stream")
Stream.Type = adTypeBinary
Stream.Open
Stream.LoadFromFile Server.MapPath(FileName)
While Not Stream.EOS
Response.BinaryWrite Stream.Read(1024 * 64)
Wend
Stream.Close
Set Stream = Nothing
Response.Flush
Response.End

回答2:

1、Setup:
Set theDoc = Server.CreateObject("ABCpdf5.Doc")
theDoc.Rect.Inset 72, 144 2、Page:
theDoc.Page = theDoc.AddPage()
theURL = "http://www.yahoo.com/"
theID = theDoc.AddImageUrl(theURL)3、Chain
Do
theDoc.FrameRect ' add a black border
If Not theDoc.Chainable(theID) Then Exit Do
theDoc.Page = theDoc.AddPage()
theID = theDoc.AddImageToChain(theID)
Loop4、Flatten
For i = 1 To theDoc.PageCount
theDoc.PageNumber = i
theDoc.Flatten
Next5、Save:
theDoc.Save "c:\mypdfs\pagedhtml.pdf"

回答3:

另存为pdf格式,如果不能另存在网上下载一个格式转换器就可以