Aanvik
asked on
iTextSharp C#
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?
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();
}
Inv-1000-Client-A.pdf
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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