2009-11-26 137 views
0

這是我的代碼,當我從localhost調用此代碼,打印機工作,但從陽極 知識產權noting。我認爲DrawImage功能不工作。誰可以幫助我。我檢查正確創建的Bitmap對象和Image存在。問題與e.Graphics.DrawImage()

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); 
} 
+0

許多開放的問題...... Server.MapPath做什麼...你是什麼意思與「來自另一個IP」... – Bobby 2009-11-26 11:09:49

+0

檢查字符串的值在你的代碼...可能會給你一些線索 – TimothyP 2009-11-26 11:11:16

回答

2

看來你在asp.net環境(Server.MapPath)&假定您可以獲得客戶機上的打印機的保持。

如果您正在嘗試這樣做,則無法完成。
另一方面,您不能在winforms環境中使用Server.MapPath

+0

Server.MapPath正常working.it返回的路徑,我chking它正確。和Bitmap對象是正確的,我認爲DrawImage()函數正確dosnt的工作,因爲當我運行本地主機sayt它工作和打印數據,否則什麼都沒有。 – Noro 2009-11-26 11:31:10