我如何使用HTML标记构造图像? [英] How can I construct images using HTML markup?

查看:90
本文介绍了我如何使用HTML标记构造图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用微软的 HTMLDocument 对象在HTML中显示报表和事情。

不幸的是,你可以给文档的HTML标记,但你不能给它的图像。它只能显示你从URL获得的图像,例如:

li> file://
  • res://



  • 可以使用HTML标记,逐个像素的像素来构建图像。



    这方面有什么工作吗?它应该绝对定位1x1色跨度?一张350x200的表格,行和列的大小都是一个像素? 解析方案

    您可以使用数据URI方案



    IE8支持这个最新的浏览器);您的图片如下所示:

     < img src =data:image / png; base64,A0123 ... = => 

    其中 A0123 ... 是图像文件的 base64 表示。根据您使用的语言,您可能可以利用 Convert.ToBase64String() 为您完成许多工作。


    I need to display reports and things in HTML using Microsoft's HTMLDocument object.

    Unfortunately, you can give the document HTML markup, but you cannot give it images. It is only able to display images you get from a URL, e.g.:

    • http://
    • file://
    • res://

    As a workaround I figured I could construct an image using HTML markup, pixel-by-colored pixel.

    Has there been any work in this area? Should it be absolutely positioned 1x1 colored spans? A 350x200 table, with rows and columns both one-pixel in size?

    解决方案

    Can you just use the Data URI scheme?

    IE8 supports this (as do most newer browsers); your images would look like this:

    <img src="data:image/png;base64,A0123...==">
    

    where the A0123... stuff is a base64 representation of an image file. Depending on the language you're using, you may be able to take advantage of Convert.ToBase64String() to do much of the work for you.

    这篇关于我如何使用HTML标记构造图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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