One common file format used online is Adobe PDF. In the PDF file format you just read the file not doing any changes. Building a PDF file using C# involves writing the document text and sending a PDF header code to the server from the user's Web browser.
1. Create a string to keep the content of your PDF file.
2. Set a header that is sent to the server. A content header is a string that the Web server uses to initiate the accurate application for the file type. In this case, the server will instruct the user's browser to use the Adobe PDF reader to open the file. Add the following code to your application:
Response.AddHeader("content-type", "application/pdf");
3. Give the new PDF file a name. The file name is used to write the information to the server's directory. The following code produces a PDF file named "myFile.PDF":
Response.AddHeader("Content-Disposition, attachment; filename=myFile.pdf");
Bookmarks