Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


iTextSharp C#

Posted on 2010-09-01
Medium Priority
Last Modified: 2012-05-10
I am trying to create this pdf via C# but no luck .. I started but there are too many questioins like how to add image or how to align text to right with color...

Can anyone please help here?

private void button1_Click(object sender, EventArgs e)
            Document pdfDocument = new Document();
            PdfWriter.GetInstance(pdfDocument,new FileStream("C:\\WDPT.PDF", FileMode.Create));
            Paragraph p = new Paragraph("CM Box E15, Toowong Village");
            p.Alignment = 2;
            pdfDocument.Add(new Paragraph("9 Sherwood Rd, Toowong"));
            pdfDocument.Add(new Paragraph("Brisbane QLD 4066"));
            pdfDocument.Add(new Paragraph("Ph: 07 3870 1740"));
            pdfDocument.Add(new Paragraph("Fax: 07 3870 1748"));

            PdfPTable table = new PdfPTable(3);
            PdfPCell cell = new PdfPCell(new Phrase("Header spanning 3 columns"));
            cell.Colspan = 3;
            cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
            table.AddCell("Col 1 Row 1");
            table.AddCell("Col 2 Row 1");
            table.AddCell("Col 3 Row 1");
            table.AddCell("Col 1 Row 2");
            table.AddCell("Col 2 Row 2");
            table.AddCell("Col 3 Row 2");


Open in new window

Question by:Aanvik
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 33583346

Please check the code files provided by Author at link (you will found codes for your requirements):


Accepted Solution

nipunu earned 2000 total points
ID: 33583704

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question