![]() ![]() HtmlTextWriter writer = new HtmlTextWriter(sw) If you want to read text from other source like plain text file or user input, ignore all above lines StreamReader inputstream = new StreamReader(responseData) Stream responseData = webClient.OpenRead(" //converting stream into stream reader object passing url of local web page to read its html content You may want ignore this code if you are aware about how to do it. The following code is just for reading other web page using WebClient and converting response into string reader (or reading text file into stringreader). PdfWriter pdfDoc = PdfWriter.GetInstance(itextDoc,Response.OutputStream) Īt the end generated PDF file is going to be outputted to outputstream. In button click event, create object of Document and PDFWriter Document itextDoc = new Document() After creating couple of textboxes for input, I want to write code on button click event.īefore that, lets add few references in our code. I wanted to test using some other site’s html page as a source to convert into pdf also, i would user entered string to convert into pdf. To demonstrate the use, i have created a sample web application in c# and added reference to iTextSharp.dll. To start with, download iTextSharp dll from official page here iTexSharp is a c# version of original Java library iText. Focus of this article would be on simply creating a pdf file with different sources of text. I intend to cover other features of iTextSharp component. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |