Render HTML to TIFF

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 13:15:08
GeReV

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.

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()

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.

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