PDF报告生成 [英] PDF Report generation
问题描述
编辑:我使用ABCpdf完成了这个项目。对于任何有兴趣的人,我喜欢这个产品,他们的支持是A +。所有我列为HTML - > PDF解决方案的'Con'在ABCpdf中很容易做。
我已经负责创建一个数据驱动的pdf报告。在查看过多的选项后,我将其缩小到2.我需要你们帮助我决定,或提供我没有考虑的替代方案。以下是要求:
- 100%数据驱动
- 最终,PDF
- 可以使用多组数据运行(布局总是相同,数据是可变的)
- 包含正常的分析样式副本(以HTML标记保存在DB中)
- 包含表格(表格数据在运行时生成)
-
-
- .NET(VB或C#)
- > 快速完成
现在,由于报表将生成多个集的数据,我不认为一个印记的pdf模板将工作,因为我不知道某一报告可能需要多长或多少页。
所以,我认为我最好的选择是:
- 使用iText类解决方案的程序化创建。
- 使用第三方应用程序生成HTML并转换为PDF(ABCPdf是我目前使用的工具)
两者
程序化解决方案:优点:
- 灵活
- 简易页面编号/页眉/目录
- 免费
缺点:
$ b
- 耗时(在iText之上写一个层来做我需要的并保持可维护性)
- 已经存储在带有html标记的数据库中,我必须先解析数据,然后将其放入pdf,确保我不必打破段落成块,所以我可以应用粗体,斜体,下划线等。到特定短语。这似乎是一个巨大的PITA,我希望我错了这个假设。
HTML - > PDF
优点:
- 许多转换工具
- 使用我已经熟悉的技术
- >内置打印预览 - 不是要求,但很好
缺点: >
(在项目完成后编辑。我的所有假设都不正确,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:
- 100% Data driven
- Eventually PDF (a stop in HTML is fine, so long as it is converted)
- Can be run with multiple sets of data (the layout is always the same, the data is variable)
- Contains normal analysis-style copy (saved in DB with html markup)
- Contains tables (data for tables is generated at run-time)
- Header/Page # on each page
- Table of Contents
- .NET (VB or C#)
- 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:
- Programmatic creation using an iText-like solution.
- 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:
- Flexible
- Easy page numbering/page header/table of contents
- Free
Cons:
- Time consuming (to write a layer on top of iText to do what I need and keep maintainable)
- 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:
- Easy to generate from db (no parsing necessary)
- Many tools for conversion
- Uses technology I am already familiar with
- 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屋!