Generate PDF's from .NET

dotnetjunkie

Posted by dotnetjunkie // Sun, Apr 2, 2006 4:53 AM

What is the best (preferably free) library / component to generate a PDF file from within our .NET code?

BTW, I'm using Visual Studio 2005 - .NET 2.0, so it would be best if the library were 2.0 as well...
  PocketXP
  More Cowbell
 
  Sun, Apr 2 2006 5:17 AM
iText is my favorite.

http://itextsharp.sourceforge.net/



  dotnetjunkie
 
 
  Sun, Apr 2 2006 7:25 AM
PocketXP wrote:
iText is my favorite.

http://itextsharp.sourceforge.net/


I'm going to have a look at it, thanks.

Is there a 2.0 assembly available somewhere?
Or can it be compiled in 2.0 from source without any modifications?

  armbrat
  Ricky
 
  Sun, Apr 2 2006 1:44 PM
I had to populate existing PDF forms, and this was the component I licensed.

http://www.o2sol.com/pdf4net/products.htm

It works quite well - no problems.

  Mads Hobye
 
 
  Sun, Apr 2 2006 4:10 PM

Hey Use Nfop thats very easy to use and you can use xsl-fo for the transformation. This code snippet is from one of my projects - had a hard time finding a good example.


                // Load the style sheet.

                string xslfofile = m_Process.Root + @"\Custom\Components\FrontEnd\Xsl\-pdfxslfo.xsl";

                // Execute the transform and output the results to a file.

                string xslfo = InventIt.SiteSystem.Library.CommonXml.TransformXsl(xslfofile, m_Process.XmlData, m_Process.Cache);
                java.io.StringReader streamFO = new java.io.StringReader(xslfo);
                InputSource src = new InputSource(streamFO);

                java.io.ByteArrayOutputStream streamOut = new java.io.ByteArrayOutputStream();
                Driver driver = new Driver(src, streamOut);
                driver.setRenderer(1);
                driver.run();


                System.Web.HttpResponse response = m_Process.HttpPage.Response;
                m_Process.OutputHandledByModule = true;
                response.Clear();

                response.AddHeader("Content-Disposition", "attachment; filename=pension.pdf");

                sbyte[] sB = streamOut.toByteArray();

                byte[] b = new byte[sB.Length + 1];

                for (int i = 0; i < sB.Length; i++)
                {

                    b[i] = (byte)sB[i];
                }


                response.BinaryWrite(b);

                response.Flush();
                response.Close();
                streamOut.close();



  Red5
  I'm on the leader
 
  Mon, Apr 3 2006 5:05 PM
PocketXP wrote:
iText is my favorite.

http://itextsharp.sourceforge.net/



Hey Thanks!  I needed a PDF assembly like this.  It helped solved one of my problems today.

  mawcc
  ...
 
  Mon, Apr 3 2006 5:54 PM
You could also use the new Report Controls in local processing mode. All reports can be exported as PDF (or XLS).