0

I am creating a fee voucher for a school using C# and the main problem that I am coming across is how do I display data on PDF in organized way like:

Name: Student Name       Name: Student Name       Name:Student Name
 A/C#: 12345              A/C#: 12345              A/C#:12345

And when I run my program this is how the data is displayed in the PDF:

Name: Student Name       Name: Student Name       Name:Student Name
A/C#:12345         A/C#:12345               A/C#:12345
  1. I have tried using padleft() property but the result is same.

  2. I have also tried the below code but none of them fulfill my requirements.

     Document doc = new Document(iTextSharp.text.PageSize.A3.Rotate());
     PdfWriter wri = PdfWriter.GetInstance(doc, new FileStream("Test.pdf", FileMode.Create));
     doc.Open();
     Paragraph para = new Paragraph($" {"Name:",-17} {"Faheel Mohammad"}"+ $" {"",-43} {""}"+ $" {"Name:",-17} {"Faheel Mohammad"}" + $" {"",-43} {""}" + $" {"Name:",-17} {"Faheel Mohammad"}");
     Paragraph para2 = new Paragraph($" {"A/C #",-17} {"12345"}" + $" {"",-43} {""}" + $" {"A/C #",-17} {"12345"}" + $" {"",-43} {""}" + $" {"A/C #",-17} {"12345"}");
    

Can anyone help me in achieving what I need?

Braiam
  • 1
  • 11
  • 47
  • 78
  • You apparently use an iText version before 7.x. In that case have you tried using the iText `PdfPTable` class to draw a tabular layout? – mkl Feb 17 '19 at 14:23
  • There is an iText product called iText DITO which is built on top of iText Core, pdfHTML and pdfCalligraph plugins. The good thing is that DITO has a free browser based template editor where you basically design your PDF. Instead of writing code, you can visually design what you want to achieve. You can preview your PDF output as well. Go ahead and try: https://dito.online. Note: I am working at iText. – Aykut Avci Feb 17 '19 at 17:11

0 Answers0