...

View Full Version : How to create pdf file or pdf report in ASP



anitha2324
09-16-2007, 11:34 AM
Hi all am trying to open a page or report in pdf

i got the following from the net and i tried it

the script is as the following


<%
Response.buffer = true
with response
.Clear
.ContentType = "application/pdf"
.Charset = "UTF-8"
.AddHeader "Content-Disposition","attachment;filename=test.pdf"
end with

Response.Write "Hi to my pdf file "

Response.Flush
Response.end
%>



when i run the above program it asks me whether to download or save the pdf files and in the both cases am getting the following error when am trying to open it


"Adobe Reader could not opent 'test[1].pdf' because it is either not a supported file type or because the file has been corrupted ( fro example , it was sent as an email attachment and wasn't correctly decoded)"


plz help me am newbie to ASP

SouthwaterDave
09-16-2007, 07:50 PM
A pdf file contains many binary codes. It is not a simple text file.

Setting the content type and the header warn the client browser to expect a Response stream that must be rendered by a pdf reader. What you also have to do is send the the binary codes that appear in a pdf file to the Response stream.

It is possible to write suitable crafted XML for client browsers to view as Microsoft Excel and Word files. I suspect it is much harder for pdf files. You will probably need proprietary software, which you may have to pay for, to achieve this.

ess
09-16-2007, 08:16 PM
Yes, it is possible to create PDF files using ASP...but you might have to get a third party library or plugin in order to do this...if you web host doesn't already support this functionality that is.

So, get in touch with your hosting company and ask if they support PDF generation.

If they don't support PDF at all, then you may wish to check out ASPPDF which is an ActiveX plugin that allows you to create PDF files on the fly.

http://www.asppdf.com/

Cheers,
~E

anitha2324
09-17-2007, 08:50 AM
thanks alot for all the replays,

but is it possible to make make that without the need for a third party component ....???

anitha2324
09-22-2007, 01:01 PM
thanks alot for all the replays,

but is it possible to make make that without the need for a third party component ....???



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum