Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C#/ASP.NET creating presentable invoice in PDF

I want to create a PDF for invoice, I have used iTextSharp's DLL, and I am able to create a PDF successfully. I am using Visual C#.NET with ASP.NET.

The problem is that, I want to put the Information Heading on the left side and then the concerned information regarding that information heading on the right side. For example:

<blink>
First Name: John Marshal
Address: Missouri
Street: Honolulu 23rd
</blink>

Here I refer to "First Name, Address, Street" as Information Heading and "John Marshal, Missouri, Honolulu 23rd" as information.

Is there any solution to place all this stuff aligned, so that the invoice becomes presentable and meaningful as well. Although I have used the spaces to create this formatting as shown below:-

document.Add(new Paragraph("        CROWN SERVICE LIMITED", new Font(Font.BOLD, 25)));
document.Add(new Paragraph ("               John Marshal ", new Font(Font.BOLD, 20)));
document.Add(new Paragraph ("               Missouri Honolulu 23rd", new Font(Font.BOLD, 20)));

Although I have tried to use an image in the background of PDF, but it still doesn't seem appropriate.

I think there can be some resolution through converting the data into an XML, if it is possible, please let me know.

like image 616
Farman Shah Avatar asked Mar 05 '11 12:03

Farman Shah


1 Answers

Use a table.

See this blog post: http://www.mikesdotnetting.com/Article/86/iTextSharp-Introducing-Tables

like image 115
Bravax Avatar answered Sep 21 '22 14:09

Bravax