niedziela, 31 lipca 2016

Review of tools for PDF generate in .net

 This is my first blog post in English, so fill free to add your comment if any part is incomprehensible.

We have many pdf libraries that we can use, but none of them are perfect and all of them have some advantages and disadvantages. Here is my little experience with generating PDF file in .net framework with generating reports both, in a browser on demand and large numbers in bash/console by night.

Crystal_Reports - big, commercial library develop by big company
Pros: 
- can be really fast
Cons: 
- ugly (at least not pretty) reports
- works on my machine issue (your report can be seen different in different machine, in example on server what can be frustrating when troubleshooting). 

SQL_Server_Reporting_Services - big library that comes with commercial licence for MS SQL Server
Pros:
- quite pretty
- have many in common with office / excel, so you BI can help you in building reports
- can use custom fonts
Cons:
Local Mode:
- have memory leaks (you will see it when you try generate PDF in large numbers)
- more complicated reports can be really slow (reporting services team upgrading reporting services from .net 3.5 to 4.0 made bug with grouping rows in table).
- don't have justify text 
- you can't "copy/paste" document from MS Word
Server Mode:
- sometimes there are issue with authentication and priviliges
- you can't use collection of your objects as data source (it was a reason why I choose Local Mode).
- don't have justify text 
- you can't "copy/paste" document from MS Word

Wkhtmltopdf - open source library made by google for converting html into pdf
Pros:
- quite fast
Cons:
- graph from jQuery library are medium quality (in magnification you can see pixels)
- few options for editing text

MS Word Interop - native MS Word API for CRUD operations in word documents
Pros:
- best MS Word document projection
Cons:
- slow
- need to have MS Office Word installed on working machine
- requires a little work and workarounds when we want to use it from task scheduler ( http://stackoverflow.com/questions/1006923/automating-office-via-windows-service-on-server-2008/1680214#1680214 )
- requires a much more work when we want to use it from IIS 

Telerik - Kendo-UI - commercial library to creating great html, and export it to pdf
Pros:
- quite pretty
- write html and just export it into pdf
Cons:
- have trouble with custom fonts 
- pdf generation could be faster 

4 komentarze:

  1. iTextSharp https://sourceforge.net/projects/itextsharp/
    iText is a PDF library that allows you to CREATE, ADAPT, INSPECT and MAINTAIN documents in the Portable Document Format (PDF):
    - Generate documents and reports based on data from an XML file or a database
    - Create maps and books, exploiting numerous interactive features available in PDF
    - Add bookmarks, page numbers, watermarks, and other features to existing PDF documents
    - Split or concatenate pages from existing PDF files
    - Fill out interactive forms
    - Serve dynamically generated or manipulated PDF documents to a web browser

    iText is used by Java, .NET, Android and GAE developers to enhance their applications with PDF functionality.
    iTextSharp is the .NET port.

    OdpowiedzUsuń
    Odpowiedzi
    1. Hi. I think that I used iTextSharp twice, but not sure for 100% it was iTextSharp.
      First: I used it for merge 2 existing PDF files (it work good for me).
      Second: In project, that I get from other developer and I noticed that putting text in bigger object in example paragraph or rectangle have big downgrade about setting different fonts style. In example, we have text document, that have 10 sentences, but inside that sentences we need to bold and underline some words. When you have text in rectangle you can set only one text style into rectangle.

      Usuń
  2. FO.NET https://fonet.codeplex.com/

    XSL-FO is similar to HTML in that it allows documents to be created in a markup language. The fundamental difference between the two is that XSL-FO is intended for creating paged, printable documents, whilst HTML is more suited to onscreen documents.

    FO.NET processes XML documents that conform to the XSL-FO specification and produces Adobe PDF documents. Typically an XSLT style sheet is used to transform raw XML data into XSL-FO.

    FO.NET has been written for the Microsoft .NET Framework and is suitable for use from any .NET compatible language such as C#, VB.NET or C#.

    OdpowiedzUsuń
    Odpowiedzi
    1. Hi. Thank you for your comment. I have never heard about OF.NET. I check it. Thanks

      Usuń