在Silverlight中使用html [英] html to png in silverlight

查看:102
本文介绍了在Silverlight中使用html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个挑战,我必须转换一个html页面,它在服务器上托管到png。

我已经浏览了很多网站。他们都为基于Windows的应用程序提供解决方案。



任何帮助将不胜感激。





谢谢

Hi All,
I have a challenge, I have to convert an html page, which is hosted on the server to png.
I have gone through many websites. They all are providing solution for windows based application.

Any help will be appreciated.


Thanks

推荐答案

我想,你想在客户端保存某种格式化的文本作为图像。有办法做到这一点,但我建议你在服务器端进行,并将其作为内容发送给客户端。首先,因为你在服务器os中有比在silverlight中更多的可能性。正如您所说,内容也在服务器上。

在服务器端你可以调用任何工具,甚至是IE - 但这很复杂。您可以简单地生成一个进程并调用一个为您生成图像的命令行工具。如果这可能持续很长时间,您可能会使用一些异步回调到客户端(但也有其他选项)。我还没有找到任何用于Windows的免费cli工具,但是商业用途( http://www.coolutils.com/HTML-PNG -CommandLine [ ^ ]或 http://www.verypdf.com/app/html-to-any/index.html [ ^ ])。

但你也可以制作自己的工具(或者没有工具,只生成图像),从这篇伟大的文章开始:您将使用的专业HTML渲染器 [ ^ ]。
I assume, you want to save on client side some sort of formatted text as image. There are ways to do that, but I suggest you do it on server side, and send it to the client as content. First of all, because you have more possibilities in a server os than in silverlight. And the content is also on the server, as you stated.
On server side you can call any tool, even IE - but that''s complicated. You can simply spawn a process and call a command line tool that generates the image for you. If this could last long time, you might use some async callback to the client (but there are other options too). I have not found any free cli tools for windows, but commercial ones (http://www.coolutils.com/HTML-PNG-CommandLine[^] or http://www.verypdf.com/app/html-to-any/index.html[^]).
But you can also make your own tool (or no tool, just generate the image), starting from this great article: A Professional HTML Renderer You Will Use[^].


没有一个预定义方式将HTML转换为PNG,因为概念完全不同。



HTML文档没有一定的大小和形状,其外观取决于渲染引擎等几个因素,预定义的样式取决于用户的喜好(很少用CSS全面描述所有样式),最重要的是,用于查看页面的浏览器窗口的大小。相比之下,PNG是具有固定图像大小的位图(以像素为单位)。



如果你解释了你的最终目标,你可以得到关于该做什么的确切建议。



-SA
There is no one "predefined" way to "convert" HTML to PNG, because the concepts are completely different.

HTML document does not have certain size and shape, its appearance depends on several factors like rendering engine, predefined styles depending on user preferences (it''s rare that all styles are comprehensively described with CSS), and, most importantly, in the size of the browser windows used to view the page. In contrast, PNG is the bitmap with fixed size of the image in pixels.

If you explain your ultimate goals, you can get exact advice on what to do instead.

—SA


这篇关于在Silverlight中使用html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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