Solved

iTextSharp C#

Posted on 2010-09-01
2
621 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
[X]
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
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unlocking a column in excel using C# 17 33
Problem to Office 1 67
C# DateTime Help 6 47
C#: How do I test for null objects and a dub a value? 2 37
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
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.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

751 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