HTML + CSS现在在生成打印报告方面有多成熟? [英] how mature is HTML+CSS now in relation to generating reports for printing?

查看:146
本文介绍了HTML + CSS现在在生成打印报告方面有多成熟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑将一系列桌面商业应用的所有报告直接创建为html。大多数报告都是表格(可能是复合报告),页眉,页脚等(没有图像,矢量图形等)。

在SO搜索后,我已经阅读了很多关于分页符和类似问题的文章(我根本不需要像素定位,但是是例如,假设我有一个包含货币值的大表,并且我需要每页显示的最后一行来显示在这一点上的运行总数..这是可行的做法很容易或我会遇到很多麻烦?



什么技术可以帮助我在这里?
$ b


  • HTML5

  • Javascript

  • CSS
  • >
  • PHP Librarys

  • JQuery



p>


  • html将会嵌入chrome或firefox引擎,所以浏览器之间的区别对我来说不是问题。

  • 如果能够更轻松地生成报告,我可以嵌入php预处理器,我只需要在h并使工作顺利。

  • 我厌倦了使用所见即所得设计器(Crystal Report,FastReport,ReportBuilder等)的报表生成器。


谢谢!

解决方案

差不多一年前考虑过,并没有回头。大多数与我们客户的沟通都是通过网络进行的,所以它非常适合。他们可以在我们的网站上轻松查看html输出,并且可以在需要时生成页面的pdf(服务器端)。我们用于pdf转换的程序是一个免费的,易于使用的开源项目,名为 wkhtmltopdf



我们在哪里很棒,但到这里很困难。

b
$ b

确定使用哪个pdf引擎是一个漫长而痛苦的过程。简而言之,HTML是用于在互联网上查看页面,而不是用于在纸上查看页面。分页符将成为你在这个游戏中存在的祸根 - 你实际上必须测量每个页面,并为每个报告创建自己清晰的中断(否则,所有的html到pdf转换器都会只是继续将文档渲染到下一页,因为如果没有遇到任何分页符)。更复杂的是,每个html-to-pdf引擎都会以不同的方式处理这个sh * t,必须编写量身定制的解决方案来测试每个人是否满足您的个人需求。

现在,好消息是:



您可以通过听取我的建议并使用 wkhtmltopdf 为您的最终报告输出。这个小程序简直太神奇了 - 它使用webkit引擎,准确地呈现CSS / javascript,具有页眉/页脚控制,可选地创建一个目录页面,并且(最重要的是)始终如一地生成优秀的PDF格式,而无需自定义你的代码库。它也有很多很棒的命令行开关,,它非常非常快。我再说一次:非常非常快。



最重要的是,它是一种可用于批处理的命令行工具。我有没有提到它真的非常快?

I'm considering creating all the reports of a series of desktop business apps directly to html. Most of the reports are tables (maybe compound reports), headers, footers, etc. (no images, vector graphics, etc.).

After a search in SO, I've read lots of post regarding problems with page breaks and things like that (I don't need pixel positioning at all, but yes control at page breaks).

For example, let's say I have a big table with currency values and I need the last row of the table per page to display the running totals at that point.. it is something feasible to do easily or I will run in lots of trouble?

What technologies can help me here?

  • HTML5
  • Javascript
  • CSS
  • PHP Librarys
  • JQuery

Some notes:

  • The html will be displayed with the chrome or firefox engine embeded, so the diferences between browsers it's not a problem for me.
  • I can have the php preprocessor embedded if that helps to generate more easily the reports, I'm just looking fot the best technology at hand to make the work well..
  • I'm tired of report generators with "WYSIWYG" designers (Crystal Report, FastReport, ReportBuilder, etc.)

Thanks!

解决方案

We made the exact move you're thinking about almost a year ago and haven't looked back. Most communication with our client is over the web, so it's been a perfect fit. They can view html outputs easily on our website, and can generate pdf's of the page (server side) whenever necessary. The program we use for pdf conversion is a free, easy-to-use, open-source project called wkhtmltopdf.

Where we are is great, but getting here was difficult.

Deciding which pdf engine to use was a long, painful process. The short of it is that HTML is for viewing pages on the internet, not for viewing pages on paper. Page-breaks will be the bane of your existence in this game -- you literally have to measure each page and create your own clean-looking breaks for every single report (otherwise, all html-to-pdf converters out there will just keep rendering the document onto the next page as it if encountered no page-break at all). Further complicating the matter is that every html-to-pdf engine out there handles this sh*t differently and you'll have to write a tailored solution to test each one to see if it meets your individual needs.

Now, the good news:

You can save yourself a lot of trouble by heeding my advice and going with wkhtmltopdf for your finalized reporting outputs. This little program is simply amazing -- it uses a webkit engine, renders CSS/javascript accurately, has header/footer control, optionally creates a table-of-contents page, and (most importantly) consistently produces excellent looking pdf's without having to customize your code base. It also has a variety of great command line switches, and it is very, very fast. I say again: it is very, very fast.

Best of all, it's a command line tool that can be used in batch processing. And did I mention that it's really, really fast?

这篇关于HTML + CSS现在在生成打印报告方面有多成熟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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