.Net, ASP.NET, C#, iTextSharp, PDF, Programming, Software, Web Development

iTextSharp PdfPCell Text Alignment Example

iTextSharp Table Cells
iTextSharp Table Cells

iTextSharp lets you do some fancy things with table cells that can make your generated PDF documents look exactly the way you want them to. In this example I will expand on a previous article: iTextSharp: PdfPTable Basic Example . Specifically, I will show how to absolutely size your PDF table, how to right and center align Phrase objects in your table cells, and how to horizontally and vertically align text in rotated cells. Continue reading “iTextSharp PdfPCell Text Alignment Example”

.Net, ASP.NET, C#, iTextSharp, Programming, Software

C# iTextSharp Stream or Save Content using XMLWorkerHelper

iTextSharp to PDF
iTextSharp to PDF

When working with the iTextSharp PDF generation libraries for C#, you can use the XMLWorkerHelper object to export a Web page to PDF format. However while doing so you will run into the question of how best to serve the PDF up to your users.

Bottom line here is that you have two ways of doing so:

  1. You can stream the PDF document directly to the client browser
  2. You can create the PDF on the Web Server’s hard-drive and then redirect the client browser to the file

Each method has its pros and cons which you will have to weigh when deciding which technique to use.

At the end of this article I will give the example code in C# of how to generate a PDF using each of these two techniques.

Feel free to read some other articles I have written about using the iTextSharp PDF generation libraries with your .NET code.
Continue reading “C# iTextSharp Stream or Save Content using XMLWorkerHelper”