Archive for the ‘PDF’ Category

Export DataTable to PDF

August 8, 2010 Leave a comment

In one of my previous posts Create PDF Documents in ASP.NET, I explained how we can create PDF document in ASP.Net applications.

By using the open source iTextSharp library, i have created a class to export a Data Table to PDF document. This is an initial version of the utility class. This can be used to export a Data Table to PDF document in the form of table. This class uses iTextSharp dll for creating PDF document. To start using this utility, you will need to download the iTextSharp library from and reference it in your project.

Click here to download source code for DataTable2PDFDocument.


Create PDF Documents in ASP.NET

August 7, 2010 Leave a comment

If you want to create PDF documents in your Dot Net web/desktop application, without purchasing any 3rd party control, then iTextSharp is the right choice for you. iTextSharp is an open source library distributed under GNU Public License. You can freely use this component in your personal and commercial applications.

iText# (iTextSharp) is a port of the iText open source java library for PDF generation written entirely in C# for the .NET platform. Use the iText mailing list to get support.

Project page at SourceForge contains DLL and source for this nice library.  You can also find some example projects on the files page.

You can find a brief article and source code example on a code project article Creating PDF Documents in ASP.NET

Please note, iTextSharp is useful where you want to create a PDF document with custom text. With iTextSharp you will have to create the text for PDF in code (see examples or code project article for details). But if you want to convert HTML text or a HTML page to PDF directly, you will either have to extend iTextSharp or you will have to use some other component or library, you can give a try to ABCpdf.Net for conversion purposes.

If you want to use iTextSharp to convert HTML to PDF, you can start it by reading a very good article “iTextSharp – Simplify Your HTML to PDF Creation” at

I am working on a generic control that will create a PDF file from a DataTable, i will share the control once it is ready.

Categories: ASP.Net, PDF Tags: , , ,

Make PDF Documents Secure

June 25, 2010 1 comment

Close the door on document leaks and piracy (

We mostly serve our documents as PDF over web. PDF files may contain valuable information that we need to make secure and we may need to control the access to PDF files. We can control some rights like copy of text and images but these rights are of static nature and are done on file level and we cannot control these basic rights on basis of users or access time. Further more by default there is no way to control the print, save access on user level.

If we really want to control PDF security in a dynamic and real time fashion, File Open is the solution.

“FileOpen Systems provides digital rights management software to prevent piracy and control access to documents, on your Web site, via email, on DVDs, CDs and mobile devices.

Built on open standards for data encryption and display, FileOpen document security solutions are trusted by corporations, governments, and publishers worldwide.”

FileOpen provides command-line tool as well as a Dot Net assembly, which can be used in desktop and web applications.

We can control rights on PDF files on individual user level, we can also control if we want to restrict PDF access on the basis of machines. To manage custom access rules, we can write our own authentication server, which will simply be a page (in ASP.Net or any other server side language) and we can write custom code according to our custom needs and it can control the access rights at following level:

  • File Access – Check if user has access to open the file or not
  • Save Access – Check if user has access to save PDF copy on disk
  • Copy Access – Check if user can copy content from PDF file
  • Print Access – Check if user can print PDF content (we can also control print access for specific pages)

In some next post, i will show some code and process to make PDF files secure.

Categories: ASP.Net, Secure PDF Tags: