Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What causes the "Page Header plus Page Footer is too large for the page" error in Crystal Reports?

Tags:

c#

.net

windows

I have used the following code for a print button:

Data.str = null;
//Data.str = textBox24.Text.ToString();
string s = "select * from temp_bond";
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\Real.mdb";
cn.Open();

DataSet ds = new DataSet();

OleDbDataAdapter da = new OleDbDataAdapter(s, cn);
ds.Clear();
da.Fill(ds);
Bond rpt = new Bond();
rpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "BOND_" + Data.str + ".pdf");
System.Diagnostics.Process.Start("BOND_" + Data.str + ".pdf");
//r.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "E:\\rep.pdf");
//crystalReportViewer1.ReportSource = r;
OleDbCommand cm1 = new OleDbCommand("delete * from temp_bond", cn);
cm1.ExecuteNonQuery();
cn.Close();

and I'm getting an error in this code:

rpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "BOND_" + Data.str + ".pdf");

The error is:

Page Header plus Page Footer is too large for the page. Error in File C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\temp_3f674868-8e5d-46ce-80eb-dce78bb2ba89 {17674136-B71E-4C6F-9E36-1CEB514B13BF}.rpt: Page header or footer longer than a page.

What can cause this and how can I fix it?

like image 730
anurag19 Avatar asked Aug 23 '12 18:08

anurag19


1 Answers

I have an application that has been published for years and uses Crystal Reports as an embedded document generation tool. The report that is included with my application has been working for years, and I was stumped for a while when I received a support call from a user who had received this exact error message.

After a bit of head-scratching and research, I've found that the primary culprit is the default printer on the end-users computer. If the default printer is currently configured to print on paper of a different size that is smaller than the report you are generating, Crystal Reports will give you this error message. Also, you will receive this message if the printer is set to print in an orientation different than the orientation of your CR report.

The really odd/poorly designed issue with this bug is that you will receive it, even if you declare to the runtime to simply create a PDF. I assume CR is using some of the default printer settings to initialize the runtime.

You have a few options to fix this. First, you can change the default printer to another device. You may have to do this if your default printer is of a different, non-typical form factor (e.g. a label printer.) Crystal Reports will not like the label printer if the labels are smaller than your document.

Option two is, of course, to reconfigure your printer driver to specify a paper type that is large enough to fit your document. Also, as mentioned, be sure that the paper printing preference is also set to print in the correct orientation (landscape or portrait) as your Crystal Report document expects.

Last, you can change your default printer to another printer or remove the printer from your PC. This isn't the most favorable answer, but it may be a last-case necessary step to get the message to go away.

like image 180
RLH Avatar answered Sep 26 '22 00:09

RLH