PDF file Generation using XSLFO and FOP in .NET

Introduction
This article describes how to create a PDF document using XSLFO and Apache FOP. In the example I will be exporting datatable to pdf, which we need frequently.
While developing a .NET based applications, we often come to a requirement to create a PDF document. There are lots of tutorials available for exporting to Excel, Word, etc. I decided to use XSLFO and FOP for creation of PDF document.
XSLFO is XSL Formatting Objects and can be used for formatting XML data. XSL Formatting Objects, or XSL-FO, is a markup language for XML document formatting which is most often used to generate PDFs. XSL-FO is part of XSL (Extensible Stylesheet Language), a set of W3C technologies designed for the transformation and formatting of XML data. Refer http://www.w3schools.com/xslfo/xslfo_intro.asp
Apache FOP (Formatting Objects Processor) is a print formatter driven by XSL formatting objects (XSL-FO) and an output independent formatter. It is a Java application that reads a formatting object (FO) tree and renders the resulting pages to a specified output. Output formats currently supported include PDF, PS, PCL, AFP, XML (area tree representation), Print, AWT and PNG, and to a lesser extent, RTF and TXT. The primary output target is PDF. Download the latest version of FOP from the following link  http://xmlgraphics.apache.org/fop/

Flow Diagram

I have also included the example of producing Datatable in PDf file. You can get the complete project @ my skydrive

Advertisements

B.E in Electronics and Telecommunications from Raipur, Chhattisgarh. Currently working on Microsoft's .NET and SQL Server Technology

Tagged with: , ,
Posted in ASP .NET, Microsoft .NET, XML
One comment on “PDF file Generation using XSLFO and FOP in .NET
  1. enfant says:

    Thanks for finally writing about >PDF file Generation using XSLFO and FOP in .NET | Ravi Baghel – Microsoft’s .NET and
    SQL Server Technologies <Loved it!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: