Advertisement

01.21.2008 at 04:09AM PST, ID: 23097957
[x]
Attachment Details

Error to print crystal report from IIS

Asked by loexperts in WebApplications, Crystal Reports Software, .NET Framework 2.0

Tags: C#, IIS 6.0

I am using c#, vs.net 2005 and crystal reports 9.
I have an asp.net application (use to generate a report) and an windows application (use to print the report generated in the web application).
From the ASP.NET app I run the .exe, using Process.Start, and passing the rpt file path I want to print, show the print dialog to select one printer and when I call the printtoprinter method i obtain the follow error: "Page header or footer longer than a page"
This error only ocurrs when I installed my web application in the IIS, if I execute my web application in my development environment it`s works fine.


Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
//web application
 
private void Imprimir()
    {
        logger.Debug(string.Format("Imprimir"));
 
        string nombreFichero = Server.MapPath(@"~\Serializacion") + "\\Informe_" + DateTime.Now.ToString("yyyyMMdd") + "_" +
            DateTime.Now.ToString("HHmmss") + ".rpt";
 
        ReportDocument reportDocument = (ReportDocument)Session["report"];
        if (reportDocument != null)
        {
            reportDocument.SaveAs(nombreFichero, true);
        }
 
        string rutaEjecutable = Server.MapPath(@"~\bin\Impresion.exe");
 
        ProcessStartInfo startInfo = new ProcessStartInfo(rutaEjecutable);
 
        startInfo.Arguments = nombreFichero;
 
        Process process = Process.Start(startInfo);
 
        while (!process.HasExited)
        {
        }
 
        process.Close();
        process.Dispose();
    }     
 
//windows application
private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                throw new Exception("hola");
                ReportDocument reportDocument = new ReportDocument();
                reportDocument.Load(@"C:\Inetpub\wwwroot\WebSetupPLS\Serializacion\Informe_20080121_123421.rpt");
 
                if (reportDocument != null)
                {
                    PrintDialog printDialog = new PrintDialog();
                    if (printDialog.ShowDialog() == DialogResult.OK)
                    {
                        reportDocument.PrintOptions.PrinterName = printDialog.PrinterSettings.PrinterName;
                        reportDocument.PrintToPrinter(printDialog.PrinterSettings.Copies, printDialog.PrinterSettings.Collate,
                            printDialog.PrinterSettings.FromPage, printDialog.PrinterSettings.ToPage);
 
                    }
 
                    reportDocument.Close();
                    reportDocument.Dispose();
                }
            }
            catch (Exception ex)
            {
            }
 
            Application.Exit();
        }
[+][-]01.21.2008 at 04:43AM PST, ID: 20705526

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: WebApplications, Crystal Reports Software, .NET Framework 2.0
Tags: C#, IIS 6.0
Sign Up Now!
Solution Provided By: vb_jonas
Participating Experts: 2
Solution Grade: A
 
 
[+][-]01.21.2008 at 05:17PM PST, ID: 20711146

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628