Making Tiff image inside Windows service
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#?
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
精彩评论