在 Windows 服务中制作 Tiff 图像

发布于 2024-11-13 18:22:18 字数 185 浏览 8 评论 0原文

我有一个 Windows 服务,我需要从 XML + XSL 创建一个 tiff 图像。

我找到了一种方法来进行争吵,但这适用于网络浏览器和 DrawToBitmap。 但这在 Windows 服务中是不可能的,因为不可能在 Windows 服务中使用 Web 浏览器类。

为什么要用 C# 将 tiff 图像形成 XML?

I have a Windows Service and I need to create a tiff image form a XML + XSL.

I found a way to make a tiff but this works with a web browser and DrawToBitmap.
But this is not possible inside a Windows Service because it is not possible to use a web browser class inside a Windows service.

Is there a why to do make a tiff image form a XML with C#?

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

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

发布评论

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

评论(1

玩心态 2024-11-20 18:22:18

我不知道你要对图像做什么,但要在 Windows 服务中动态创建图像:

添加对 System.Drawing 的引用,

尝试这种方式:

using System.Drawing;

namespace WindowsService1
{
    public partial class Service1 : ServiceBase
    {
        public Service1()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            Bitmap myBitmap = new Bitmap(100,100);
            Graphics g = Graphics.FromImage(myBitmap);


        }

        protected override void OnStop()
        {
        }
    }
}

更新

你的方向是正确的使用网络浏览器和DrawToBitmap!要使用 WebBrowser,您需要包含 using System.Windows.Forms; 并且必须在 System.Windows.Forms 中添加引用,

这是一个示例:

http://www.codeproject.com/KB/graphics/html2image.aspx

更新

您还可以看这里:

HTML 到图像 .tiff 文件

或此处:

将 HTML 渲染为 TIFF

更新

我找到了这个:

http://code.msdn.microsoft.com/CSASPNETSaveWebpageToImage-5299048d

I don't know what you have to do with the image but to create an image on the fly in a windows service:

Add reference to System.Drawing

try this way:

using System.Drawing;

namespace WindowsService1
{
    public partial class Service1 : ServiceBase
    {
        public Service1()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            Bitmap myBitmap = new Bitmap(100,100);
            Graphics g = Graphics.FromImage(myBitmap);


        }

        protected override void OnStop()
        {
        }
    }
}

update

You are in a right direction using web browser and DrawToBitmap! To use WebBrowser you need to include using System.Windows.Forms; and you have to add reference at System.Windows.Forms

this is an example:

http://www.codeproject.com/KB/graphics/html2image.aspx

update

You can also look here:

HTML to Image .tiff File

or here:

Render HTML to TIFF

update

I've found this one:

http://code.msdn.microsoft.com/CSASPNETSaveWebpageToImage-5299048d

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