Tuesday, 16 December 2014

PDF creation using Sharp-PDF C#

Simple example for creating PDF file using Sharp-PDF

Background


I came across a new library for developing PDF in C# named as SharpPDF . It is open source .net dll . Find the URL here http://sharppdf.sourceforge.net/ .

You will find many tutorials on the net. But, I thought of sharing what I know (not completely).

Hoping for ?



A generic class to create pdf with different generic objects and mail it as attachment.

Status


Incomplete

Lets get on


There are many objects that is supported by SharpPDF . Below are just a glimpse of objects supported in SharpPDF and used here in the post are
  • Text Object
  • Image Object
  • Table Object

The main class is pdfDocument for preparing document.

Here we can add text or background image(Logo) using PdfDocument document .

PdfTable is the table object as specified above . Where , we use maximum of these objects
in PDF generation.

I have created a class PDFGenerate which has some properties included . And there is a Method CreatePDF with generic List (List<T> ) as input.

It will create PDF and save to the folder PDF in application.

Please find the guide related to the sharp pdf in below mentioned URL


If there are any changes required and any guidance are accepted happily.