C# ---> CSharp – Creating /storing a PDF Document with Tables, Paragraphs, watermark, and images

Your Rating: not set

A while back I had to do a small project. The project involved showing data from the database in a pdf. I searched online and found PDFSharp, iText, and iTextSharp. However, I went with PDFSharp, since it is possible to use PDFSharp for commercial use. However with iText you can post, add javascript, and fill in fields. With PDFSharp it is possible to fill in fields, but there is a small clitch that when you go to type something on the field, the original text hovers over the text you are typing; sort of like a watermark that never goes away. However, for my purposes I didn’t need to populate any fields with any values,
which is why I went with PDFSharp.

Creating a PDF using PDFSharp is similar to creating a control (textbox, label, dropdown, etc) in csharp.

To get started you would first have to create a PDF Document with a section(at least one section is required) by doing the following:



Then you would simple add to the PDF :

How to add a paragraph:

A paragraph object must be instantiated with line breaks and text.



How to add a table:

First a table object needs to be instantiated then the columns need to be
created. After the columns are created new rows can be added with cells.



UserName: Daniel
Date Joined: 12/16/2010

WebsiteURL: http://www.justaboutdaniel.com
Bio: I am a full time web developer, son, and friend to many. For more read my about me located here.


Name:
Email:
Website URL:
Comments:
 
Note:



Anonymous 4/30/2011 2:27:30 PM

Real brain power on dipsaly. Thanks for that answer!



Coming soon!

12

Skip Navigation Links.

Users

ads and stuff