0

Hello!

I have a small problem in asp.net ... I wish to create a pdf file and write text entered into a textbox into it using asp.net. The following lines of code work properly for creating and opening pdf files

Dim fs As FileStream = File.Create(Server.MapPath("files/newfile.doc"))
        Dim sw As New StreamWriter(fs)
        sw.Write(TextBox1.Text)
        sw.Close()
        fs.Close()

The only problem is that one I navigate to the folder and open the pdf file, it displays a message saying that the file is corrupt. I am able to open it normally using notepad, but not using pdf.

Can anyone help me out?????

Thanks a lot in advance!

4
Contributors
3
Replies
5
Views
8 Years
Discussion Span
Last Post by peter_budo
0

you are creating a file with a pdf extension, not an actual pdf file

you need to use a either a converter or a printer to create the file

i normally use pdf995.com

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.