Solved

iTextSharp C#

Posted on 2010-09-01
2
617 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 AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
WKHTMLTOPDF - --disable-smart-shrinking not working 10 89
Error in script 11 56
Hey Audio! 3 29
Calculate number of nights between two dates 5 24
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

773 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