954,595 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

creating pdf files

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!

nice_true
Light Poster
28 posts since Sep 2007
Reputation Points: 10
Solved Threads: 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

dickersonka
Veteran Poster
1,175 posts since Aug 2008
Reputation Points: 130
Solved Threads: 143
 
sierrainfo
Junior Poster
144 posts since May 2008
Reputation Points: 10
Solved Threads: 9
 

http://asp-net-whidbey.blogspot.com/2006/04/generating-pdf-files-with-itextsharp.html

http://www.developerfusion.com/code/5682/create-pdf-files-on-fly-in-c/

hope it will help u


This will not help at all! It is only small fraction of whole image behind PDF creation with iText library which has port to C#.
For full resources please go to iTextSharp

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You