- Posted by
Daniel on
6/11/2011 8:57:48 AM
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.