Wednesday, June 3, 2009

What about some PDF reports........


Well it's been quiet a long time since, I last posted on my blog. I have done a few things in the past which can be posted in my blog but, I find it dificult to gather these information in a bloggable way. So, How am I writing this post? well, I have a friend who always used to push me to write a post atleast, once a week. I should really thank him for pushing me all the time.


This post will be based on ITextsharp which is an assembly available as a freeware for creating PDF reports.

As enterprise developers we develop systems to help(enable) organizations make key business descisions on it's business domain. System reports play a major part in describing the current state of the business. If the system,budget are huge and the system is considered to be critical then an organization would go for a BI project. If the above said is not the case then they would just hang on with HTML reports. It is not a bad idea to display reports as HTML inorder to stay within budget but, this comes up with certains limitations which can be eliminated by using PDF reports.


There is a well documented and easy to use API available as a .net assembly in http://itextsharp.sourceforge.net/ and could be downloaded for free. There are a lot of things you can do by using this dll. Some of the important points are given below,

  • HTML to PDF
  • Support for working with XML,RTF,etc
  • PDF reports.
The main API has the following namespaces,

  • iTextSharp.text.xml
  • iTextSharp.text.rtf
  • iTextSharp.text.pdf
  • iTextSharp.text.markup
  • iTextSharp.text.html

The highlight of all these will be the iTextSharp.text.pdf. We can find almost all kinds of classes and methods which are used to create pdf files. It has two classes to create pdf tables one is Pdftable and the ohter is the PdfPtable. Both, have there own good and bad but, one can use either of these classes and build good looking, portable and feature rich reports. In addition to merely creating files you can also do the following,

  • Merge PDF files.
  • Append information in one PDF to another.
  • Create reports based on a template, etc.
More facts can be gathered in http://itextdocs.lowagie.com/tutorial/. I have attached a couple of reports I created using Itextsharp for you to check out.

I hope this gives you a good impression about this API and the power of it. I suggest one can make some really cool reports using this API with a bit of creativity.


Enjoy.....

Wednesday, April 8, 2009

Ummmm.... What is better

As we all know that there was a namespace as System.Web.Mail came in with the release of .net framework1.1 and it was considered as the best technique to send emails in .net until a new namespace was introduced as System.Net.Mail in .net Framework 2.0. This drew the attention of all developers and many told that this is the best technique over System.Web.Mail and this arguement is still valid. I just got a thought while thinking last week and I thought of writing a post on my blog on what makes System.Net.Mail better than System.Web.Mail. I have read a few articles on this and have summarized the information as shown below.

All of us who work in web technologies would have had to send emails in our applications.Before, the introduction of ASP.NET one had to use the CDONTS,CDOSYS APIs developed by microsoft. These APIs gave a set of methods and properties to send emails but, these dlls were tightly coupled with the OS.

With the introduction of ASP.NET which has revolutionised the web developers started moving away from these APIs towards System.Web.Mail. But, unfortunately the System.Web.Mail wasn't a .net native implementation of the SMTP protocol. Instead, it was kind of a wrapper for the CDO,CDONTS dlls. Thus, it wasn't independant from the COM libraries. This made the System.We.Mail more rigid and had to suffer all the issues related to CDO and CDONTS.
Actually, when the Smtp class sends an email it will check the OS version if it is less than 4 then it creates an object of the CDONTS.NewMail else it creates an object of CDO.NewMessage class.
Below is a list of issues related to CDO,CDONTS.

  • CDONTS has been deprecated in IIS5 and is completely removed from Windows Server 2003, and even Windows XP. Yes, it is possible to install on
    Windows Server 2003 but with the performance improvements and other enhancements, there should be no need to do so.
  • Carries a lot of overhead.
  • Using the CDO and CDONTS the System.Web.Mail had to be dependent on the COM libraries.

To overcome these issues the ASP.NET 2.0 came up with a new namespace with a new set of classes written from the ground up without any interop. Thus, it is not dependant upon other COM libraries. System.Net.Mail introduces brand new classes for creating and sending email. Although some functionality has been removed, the new System.Net.Mail namespace is much more versatile than the older CDO dependant System.Web.Mail.

The configuration settings to send emails using System.Net.Mail can be directly put in the web.config file which is another cool feature, so that when the Smtpclient.Send() method is called the settings in the web.config is picked up from the configuration file.This can be done through the code as well. Below are the settings which should be added in the configuration file to send emails using System.Net.Mail.



Monday, April 6, 2009

We all know that there is a BUZZ around the word WEB2.0. This is about the new standards which should be followed by webapplications/websites.

Just have a look at the link below if you have any leisure time and if you feel you play around with the web. This article has a .ppt presentation for u guys and it's very clear and precise on it's topic.....

Thoughts about Web2.0