ASP to PDF
Hi Everyone !!
I have an ASP page which has a report drawn from values from the database and saved as HTML file and appended to the email sending page. The HTML content is sent to recipients as email attachment. I want the attachment(HTML) to open in PDF format when the recipient gets it. I have used contentType as "application/pdf" and used Stream object to Write Binary data from the HTML content. But that does not work.
The following is the code I have used:
--------------------------------------
Response.ContentType = "application/pdf"
Set objStream = Server.CreateObject("adodb.stream")
Response.ContentType = "application/pdf"
objStream.Type = 1
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile strPath
Response.BinaryWrite objStream.Read
FileName="Temp_" & CStr(Session.SessionId) & "CustomerQuotation" & Fileid & "(" & Session("User") & ").pdf"
objStream.SaveToFile FileName
objStream.Close
Set objStream = Nothing
where strPath contains the HTML file name and FileName is the converted PDF file .
--------------------------------------
Any suggestion would be helpful, anyone who has tested this would be most welcome.
Thanks in advance
|