PDF报告生成 [英] PDF Report generation

查看:429
本文介绍了PDF报告生成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:我使用ABCpdf完成了这个项目。对于任何有兴趣的人,我喜欢这个产品,他们的支持是A +。所有我列为HTML - > PDF解决方案的'Con'在ABCpdf中很容易做。



我已经负责创建一个数据驱动的pdf报告。在查看过多的选项后,我将其缩小到2.我需要你们帮助我决定,或提供我没有考虑的替代方案。以下是要求:


  1. 100%数据驱动

  2. 最终,PDF

  3. 可以使用多组数据运行(布局总是相同,数据是可变的)

  4. 包含正常的分析样式副本(以HTML标记保存在DB中)

  5. 包含表格(表格数据在运行时生成)




  6. .NET(VB或C#)

  7. > 快速完成

现在,由于报表将生成多个集的数据,我不认为一个印记的pdf模板将工作,因为我不知道某一报告可能需要多长或多少页。



所以,我认为我最好的选择是:


  1. 使用iText类解决方案的程序化创建。

  2. 使用第三方应用程序生成HTML并转换为PDF(ABCPdf是我目前使用的工具)

两者

程序化解决方案:



优点:


  1. 灵活

  2. 简易页面编号/页眉/目录

  3. 免费

缺点:
$ b


  1. 耗时(在iText之上写一个层来做我需要的并保持可维护性)

  2. 已经存储在带有html标记的数据库中,我必须先解析数据,然后将其放入pdf,确保我不必打破段落成块,所以我可以应用粗体,斜体,下划线等。到特定短语。这似乎是一个巨大的PITA,我希望我错了这个假设。

HTML - > PDF



优点:



  1. 许多转换工具

  2. 使用我已经熟悉的技术

  3. >内置打印预览 - 不是要求,但很好

缺点: >

(在项目完成后编辑。我的所有假设都不正确,ABCpdf非常棒)



1。几乎不可能生成页眉 - 不为True

2。很难生成页码 不正确

3。几乎不可能生成目录 不正确

4.(跨浏览器支持不是一个con;因为它的内部,我可以指定什么浏览器使用)

5。转换工具很奇怪,可能无法完全转换为在浏览器中呈现 不正确

6。总的来说,我认为格式化HTML非常难,因为我希望它出现/转换为PDF。 不是真的



这就是 - 我需要社区的帮助,决定我应该走哪条路。我可能错了我的一些Pro / Con假设。如果我是,请告诉我。欢迎所有想法和建议。



感谢

解决方案

决定使用类似于
中使用的方法 http://alistapart.com/articles/boom



使用ABCPdf代替Prince,用于最终的HTML - > PDF生成。



对同样的事情感兴趣,随时向我发送有关这种方法的信息。


EDIT : I completed this project using ABCpdf. For anyone interested, I love this product and their support is A+. Everything I listed as a 'Con' for the HTML -> PDF solution was easily doable in ABCpdf.


I've been charged with creating a data driven pdf report. After reviewing the plethora of options, I have narrowed it down to 2. I need you all to to help me decide, or offer alternatives I haven't considered. Here are the requirements:

  1. 100% Data driven
  2. Eventually PDF (a stop in HTML is fine, so long as it is converted)
  3. Can be run with multiple sets of data (the layout is always the same, the data is variable)
  4. Contains normal analysis-style copy (saved in DB with html markup)
  5. Contains tables (data for tables is generated at run-time)
  6. Header/Page # on each page
  7. Table of Contents
  8. .NET (VB or C#)
  9. Done quickly

Now, because of the fact that the report is going to be generated with multiple sets of data, I don't think a stamped pdf template will work since I won't know how long or how many pages a certain piece of the report could require.

So, I think my best options are:

  1. Programmatic creation using an iText-like solution.
  2. Generate in HTML and convert to PDF using a third-party application (ABCPdf is the tool I have played with so far)

Both solutions have their pro's and con's.

Programmatic solution:

Pros:

  1. Flexible
  2. Easy page numbering/page header/table of contents
  3. Free

Cons:

  1. Time consuming (to write a layer on top of iText to do what I need and keep maintainable)
  2. Since the copy is already stored in the db with html markup, I would have to parse through the data before I place it into the pdf, ensuring I don't have to break the paragraph into chunks so I can apply bold, italic, underline, etc. to specific phrases. This seems like a huge PITA, and I hope I am wrong about that assumption.

HTML -> PDF

Pros:

  1. Easy to generate from db (no parsing necessary)
  2. Many tools for conversion
  3. Uses technology I am already familiar with
  4. Built-in "Print Preview" - not a req, but nice

Cons:

(Edited after project completion. All of my assumptions were incorrect and ABCpdf is awesome)

1. Almost impossible to generate page headers - Not True
2. Very difficult to generate page numbers Not True
3. Nearly impossible to generate table of contents Not True
4. (Cross-browser support isn't a con; Since its internal, I can dictate what browser to use)
5. Conversion tool quirks - may not convert exactly as rendered in browser Not True
6. Overall, I think it would be very hard to format the HTML exactly as I would want it to appear/convert to PDF. Not True

That's it - I need the communitys help in deciding which way I should go. I might be wrong about some of my Pro/Con assumptions. If I am, please tell me. All thoughts and suggestions are welcome and appreciated.

Thanks

解决方案

Decided on using an approach similar to the one used at http://alistapart.com/articles/boom

Using ABCPdf instead of Prince for the eventual HTML -> PDF generation.

Anyone who is interested in the same thing, feel free to message me about this approach.

这篇关于PDF报告生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆