I am using Mozilla Firefox 8.0.1 running on Microsoft Windows XP Professional Version 2002 Service Pack 3.when i try to print by selecting hp laser jet 1320 PCL 5 printer or Microsoft XPS Document Writer, the browser is getting crash.

Note: The "printing" dialog shows "progess:preparing" alone. If I click on dialog or browser it says the program is not responding. I restart browser and reset print preference (print_printer) but it is not solving my problem.

I am printing radgridview (one of the telerik control) data's from my silverlight 4.0 application with visual studio 2010.it is working fine for less amount of data but when we goes to large amount it is crashing only Firefox not other browsers such as IE, Chrome, Safari etc...

Is there any way to solve this problem?

Here is my code:

Xaml.cs page

private void PrintButton_Click(object sender, RoutedEventArgs e)

    {
        try
        {
            rptDataGridData = new RadGridView();
            rptDataGridData = reportPlaceHolder.FindChildByType<RadGridView>() as RadGridView;
            if (rptDataGridData != null ? rptDataGridData.ItemsSource != null : false)
            {
                Telerik.Windows.Controls.ExportFormat format = Telerik.Windows.Controls.ExportFormat.Html;
                format = Telerik.Windows.Controls.ExportFormat.Html;
                MemoryStream ms = new MemoryStream();
                rptDataGridData.Export(ms,
                         new GridViewExportOptions()
                         {
                             Format = ExportFormat.Html,
                             ShowColumnHeaders = true,
                             ShowColumnFooters = true,
                             ShowGroupFooters = false,
                         });

                StringBuilder data = new StringBuilder();
                StreamReader streamReader = new StreamReader(ms);
                ms.Position = 0;
                streamReader.DiscardBufferedData();
                while (!streamReader.EndOfStream)
                {
                    data.Append(streamReader.ReadLine());
                }
    
                data = data.Replace("style=", "class=\"heading\" style=");
                string htmlContent = string.Format(
                    @"<style type='text/css'>
                        html, body {{
                                    font-family:Verdana, Arial, Helvetica, sans-serif;
                                }}
                        table {{
                            border-width: 1px;
                            border-spacing: 1px;
                            border-style: none;
                            border-color: gray;
                            border-collapse: collapse;
                            background-color: white;
                        }}
                        table td {{
                            border-width: 1px;
                            padding-left: 3px;c
                            padding-right: 15px;
                            padding-top:5px;
                            padding-bottom:3px;
                            border-style: inset;
                            border-color: gray;
                            background-color: white;
                            font-size:11px;
                        }}
                        table td.heading {{
                            border-width: 1px;
                            padding-left: 5px;
                            padding-right: 15px;
                            padding-top:5px;
                            padding-bottom:5px;
                            border-style: inset;
                            border-color: rgb(192, 192, 192);
                            font-weight: bold;
                        }}
                     </Style>
                    {0}"
                    , data.ToString());



                HtmlPage.Window.Invoke("WriteContent", new object[] { htmlContent });
            }
            else
            {
                MessageBox.Show("There is no data to print", MortalMessage.MortalErrorHeading, MessageBoxButton.OK);
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message,MortalMessage.MortalErrorHeading,MessageBoxButton.OK);
        }
    }

aspx page

function WriteContent(contentToPrint) {
var ifrm = document.getElementById('frmPrint');
ifrm = (ifrm.contentWindow) ? ifrm.contentWindow :                                       (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;
ifrm.document.open();
ifrm.document.write(contentToPrint);
ifrm.document.close();
ifrm.focus();
ifrm.print();

<iframe src="about:blank" runat="server" id="frmPrint" height="0" width="0" />
1

There are 1 best solutions below

0
On

Try disabling your add-ons, restarting Firefox, and trying to print. It's possible that you have installed an add-on that is causing the freeze.

How to disable add-ons? Shift+click on Firefox to open in Safe Mode, Disable All Add-Ons and Reset Toolbars and Controls. Click on Make Changes and Restart.

I would consider upgrading your version of Firefox anyway - you stand to benefit from many more bug-fixes and improvements.