3

I want to take a list of objects and create that into a table and display that into a pdf file. Is there any good libraries out there that I can use?

MyObject a = new MyObject();
a.Name = "bob";
a.Address = "123 fake st";

pdf output

Name    Address
bob    123 fake st
jim     test

I looked at pdfsharp/migradoc but it does not seem to work on medium trust so I am not sure if it will work on my shared hosting.

I heard of itextsharp but did not really look into it as they seemed to have changed their licensing and the new licensing forces you to make your project open I believe.

chobo2
  • 83,322
  • 195
  • 530
  • 832
  • are you only interested in free libraries? I would use DevExpress XtraReports, worth every single penny, especially the DXperience subscriptions, with plenty of components for all platforms including MVC, WPF, SL, Winforms and ASP.NET classic. I made my company to acquire 14 licenses recently and we are all very satisfied. – Davide Piras Jul 19 '12 at 22:43
  • Yes free libraries only as this is just for a personal site and I really don't want to spend money on libraries for it. – chobo2 Jul 19 '12 at 22:50
  • You are using C#, asp.net. Are you using SQLServer too? It has some CLR libraries that can do this. Sounds wierd, I know, but I have been using for years. If you have SQLServer you MAY have already paid for those libraries. – joshp Jul 19 '12 at 22:58
  • I do have a database under my plan. I don't know if I get access to this feature though. If it is something that you need rights too then probably not. I also was looking for something in memory as I first generate everything in memory and might as well use that if I can. – chobo2 Jul 19 '12 at 23:04
  • I have used iText for personal use. Looked good to me. `http://stackoverflow.com/questions/204860/best-server-side-net-pdf-editing-library` – Shakti Prakash Singh Jul 20 '12 at 07:36
  • They changed their licensing agreement. So now you have to buy a license or basically make your project open source. – chobo2 Jul 20 '12 at 16:06

1 Answers1

2

You could use iTextsharp. And here's a nice article on CodeProject which illustrates how Razor views could directly be exported to PDF using iTextsharp and the RazorEngine package.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928