Solved

iTextSharp C#

Posted on 2010-09-01
2
613 Views
Last Modified: 2012-05-10
Hello,
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));

            pdfDocument.Open();

            Paragraph p = new Paragraph("CM Box E15, Toowong Village");

            p.Alignment = 2;

            pdfDocument.Add(p);

            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(cell);

            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");

            pdfDocument.Add(table);



            pdfDocument.Close();

        }

Open in new window

Inv-1000-Client-A.pdf
0
Comment
Question by:Aanvik
2 Comments
 
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 33583346
Hi,

Please check the code files provided by Author at link (you will found codes for your requirements):
http://blog.rubypdf.com/itextsharp/tutorial01/

Regards,
VSS
0
 
LVL 6

Accepted Solution

by:
nipunu earned 500 total points
ID: 33583704
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

947 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now