开发者

Problem with e.Graphics.DrawImage()

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜