开发者

Problem with e.Graphics.DrawImage()

开发者 https://www.devze.com 2022-12-13 01:57 出处:网络
This is my code and wh开发者_开发技巧en I call this code from localhost, printer worked,but from anoder

This is my code and wh开发者_开发技巧en I call this code from localhost, printer worked,but from anoder IP noting.I think DrawImage function not worked.Who can help me.I check the Bitmap object properly created and Image exist.

protected void printButton__Click(object sender, EventArgs e)
{
        System.Drawing.Printing.PrintDocument document = 
                               new System.Drawing.Printing.PrintDocument();
        document.PrintPage += new PrintPageEventHandler(document_PrintPage);
        document.Print();
}

void document_PrintPage(object sender, PrintPageEventArgs e)
{
        string s = Server.MapPath("Temp.jpg");
        Bitmap objBmpImage = new Bitmap(s);
        e.Graphics.DrawImage( objBmpImage, 10, 10, 200, 100);
}


It seems you are in asp.net environment (Server.MapPath) & are assuming that you can get hold of a printer on the client machine.

If you are trying to do that, it cannot be done.
On the other hand, you can't use Server.MapPath in a winforms environment.

0

精彩评论

暂无评论...
验证码 换一张
取 消