download to pdf

C

charmis

I wanna know as to how to download a webpage to a pdf file.
Iam able to download to word file as well as excel file. Here is the code
below?

Select Case Request.QueryString("ftype")

Case "Word"

Response.ContentType = "application/msword"

Response.AddHeader("Content-Disposition", "attachment;filename=" &
lblProjectName.Text & "defcat.doc")

Case "Excel"

Response.ContentType = "application/msexcel"

Response.AddHeader("Content-Disposition", "attachment;filename" &
lblProjectName.Text & "defcat.xls")

Case "PDF"


Response.ContentType = "application/pdf"

Response.AppendHeader("Content-Disposition", "attachment;filename=" &
lblProjectName.Text & "defcat.pdf")

End Select

Iam also able to download to pdf file but when I open the pdf file, it says
---------------------------------------------------------------------------------------------------------------------
Acrobat could not open 'bdkms.pdf' because it is either not a supported file
type or because the file has been corrupted (for example, it was sent as an
email attachment and wasn't correctly decoded).
----------------------------------------------------------------------------------------------------------------------

Iam able to open the downloaded word file and excel file successfully.
Below the above code, I have a generated report which will the content of
the downloaded file..

Thankz
 
L

Lars Netzel

Is the file you are sending to the user a real PDF file or is is just a file
you are trying to send as PDF?

You cant send whatever as PDF.. it has to be a PDF file... you need to use a
tool then to convert the file you have to a PDF file...

/Lars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top