Is there a way to print a web page via a SWF?

青春壹個敷衍的年華 提交于 2019-12-25 06:37:54

问题


In my web app, I would like to print a web page via a real, physical printer using Flash. I want to do this so that typical page headers added by the browser (eg. the URL and "Page x of y") do not get added to the printout.

Perhaps I could generate a PDF and pass it to the SWF, or perhaps I could just send raw HTML ann CSS to the SWF, and then I could call some .print() method via Javascript against the SWF.

So, 1) is this possible? and 2) is there a library (on GitHub perhaps) somewhere that would let me do this?


回答1:


I would ping a server-side script (php) which would snap shot the page you want and display the image which flash can then print using flash's printjob functionality. Hope that helps!

steps:

  • 1) load the page that will display the url snapshot (snapshot taken with php) using a Loader class. Make sure the headers are correct on the php page (so browsers think it's an image).
  • 2) use the flash printjob to print the image


来源:https://stackoverflow.com/questions/6901792/is-there-a-way-to-print-a-web-page-via-a-swf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!