Solved

iTextSharp C#

Posted on 2010-09-01
2
612 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
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 video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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

22 Experts available now in Live!

Get 1:1 Help Now