C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




How to Create text to PDF using C#.net


Posted Date: 03 Jan 2008    Resource Type: Code Snippets    Category: Console Applications

Posted By: Karthick       Member Level: Gold
Rating:     Points: 0



How to Create text to PDF using C#.net



using System;
using System.IO;
using System.Diagnostics;
using iTextSharp.text;
using iTextSharp.text.pdf;

public class iTextDemo
{
public static void Main()
{
Console.WriteLine("iText Demo");

// step 1: creation of a document-object
Document myDocument = new Document(PageSize.A4.Rotate());

try
{

// step 2:
// Now create a writer that listens to this doucment and writes the document to desired Stream.

PdfWriter.GetInstance(myDocument, new FileStream("Salman.pdf", FileMode.Create));

// step 3: Open the document now using
myDocument.Open();

// step 4: Now add some contents to the document
myDocument.Add(new Paragraph("First Pdf File made by Salman using iText"));

}
catch(DocumentException de)
{
Console.Error.WriteLine(de.Message);
}
catch(IOException ioe)
{
Console.Error.WriteLine(ioe.Message);
}

// step 5: Remember to close the documnet

myDocument.Close();
}
}








Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Create text to PDF  .  C#.net  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Detect keystrockes in C#
Previous Resource: How to convert ASCII To Hex using c# dot net
Return to Discussion Resource Index
Post New Resource
Category: Console Applications


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

internet fax

Contact Us    Privacy Policy    Terms Of Use