将 HTML 渲染为 TIFF

发布于 2024-10-21 15:56:33 字数 120 浏览 3 评论 0原文

我正在开发一个应用程序,其中要求应用程序生成 HTML 文档的 TIFF 图像以存储在文档管理系统中。我正在使用 ASP.NET MVC 3,很好奇是否有其他人遇到过类似的要求,如果有,您是如何解决的?

谢谢!

I'm working on an application where the requirements call for the app to produce a TIFF image of an HTML document for storage in a document management system. I'm using ASP.NET MVC 3 and am curious if anyone else has run into similar requirements, and if so, how did you address?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

烟雨扶苏 2024-10-28 15:56:34

这篇文章可以给你带来全面的帮助。

http://www.converthtmltoimage.com/Convert-html -to-tiff-in-vb.net.html

以下示例代码向您展示如何将 html 渲染为图像(JPG、PNG、TIF、GIF 和 BMP)

Dim _Obj As New WebsitesScreenshot.WebsitesScreenshot
Dim _Result As WebsitesScreenshot.WebsitesScreenshot.Result
With _Obj
_Result = .CaptureWebpage("http://www.WebsitesScreenshot.com")
If _Result = WebsitesScreenshot.WebsitesScreenshot. _
            Result.Captured Then
    .ImageFormat = WebsitesScreenshot. _
            WebsitesScreenshot.ImageFormats.TIF
    .SaveImage("c:\test.tif")
End If
End With
_Obj.Dispose()

This article can be help fully to you.

http://www.converthtmltoimage.com/Convert-html-to-tiff-in-vb.net.html

Following sample code shows you how to render html to image (JPG, PNG, TIF, GIF and BMP)

Dim _Obj As New WebsitesScreenshot.WebsitesScreenshot
Dim _Result As WebsitesScreenshot.WebsitesScreenshot.Result
With _Obj
_Result = .CaptureWebpage("http://www.WebsitesScreenshot.com")
If _Result = WebsitesScreenshot.WebsitesScreenshot. _
            Result.Captured Then
    .ImageFormat = WebsitesScreenshot. _
            WebsitesScreenshot.ImageFormats.TIF
    .SaveImage("c:\test.tif")
End If
End With
_Obj.Dispose()
烟酉 2024-10-28 15:56:34

上面的 @Select0r 评论中没有建议这个特定的解决方案,我相信值得一提。

我最近在 CodePlex 上遇到了这个库。它完全用托管代码编写,没有依赖项,并提供渲染到 Graphics 对象的 HtmlRenderer.Render() 函数。

您可以使用它将一些 HTML 渲染到位图上并将其保存为 TIFF 图像。

然而,这个库仍然不完美,只支持简单的布局。

This particular solution wasn't suggested in @Select0r's comment above and I believe it's worth mentioning.

I recently ran into this library on CodePlex. It's written completely in managed code without and dependencies and provides HtmlRenderer.Render() function which renders to a Graphics object.

You can use it to render some HTML onto a Bitmap and save it as a TIFF image.

However, this library still isn't perfect and only supports simple layouts.

倚栏听风 2024-10-28 15:56:34

替代想法:可以使用 Word 自动化将 html 文档保存到 PS 或 PDF 打印机驱动程序,然后从那里将其转换为 tiff。在文档存储系统中包含 PDF 也可能很有用。

Alternate idea: It may be posible to use word automation to save an html document to a PS or PDF printer driver, then convert it to a tiff from there. It may also be useful having a PDF within the document storage system.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文