Silverlight printing in web browser problem
I'm trying to pri开发者_如何学运维nt from a Silverlight application.
Printing works when I run the application Out Of Browser. But when I run it in the web browser, the Print dialog is shown but nothing happens when I click the buttons (Print, Cancel, or even close the window). I tried running without debugger attached (deployed to IIS) but it's the same thing.
The code:
private void PrintLabel()
{
PrintDocument printDocument = new PrintDocument();
printDocument.PrintPage += new EventHandler<PrintPageEventArgs>(printDocument_PrintPage);
printDocument.Print("Label for " + this.tbSerialNo.Text);
}
void printDocument_PrintPage(object sender, PrintPageEventArgs e)
{
e.PageVisual = this.csLabel;
}
Am I missing something?
This sounds like a browser-specific issue I have seen in the past. Are you running this in Firefox 3.6 or later? If so, this Firefox bug might be of some interest to you since the print dialog is a popup window as well.
You can fix this popup issue by setting dom.ipc.plugins.enabled
to false in Firefox's about:settings
menu. However, this sometimes causes mouse oddities, as described here.
If this is the case(and it sounds like it is), printing does work in Out-Of-Browser mode since its really just running Silverlight in an IE process without any toolbars.
精彩评论