Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting paper size for a Crystal Report in VB.NET 2003

Status
Not open for further replies.

jolvera

Programmer
Aug 17, 2006
2
MX
I created a Crystal Report with a custom paper size (printed form) using a paper size created from the Windows Server Properties.
The report works fine in the development computer but it defaults to Letter paper size when it is running in the target computer.
I am using then same local printer in both computers and the target computer has the same paper size defined as the default paper size for the printer as the development computer.
Any ideas on how to solve this problem?
 
Though we share this with you. I was very difficult to find. Ww got it from a Crystal Reports Printer Options document.

It is possible to design a report in the Crystal Reports Designer specifying a custom paper size. Once this report is created, it looks and prints as expected on the computer it was designed on. When this same report is distributed to a client computer, the report may appear different.

The reason why a report created using a custom paper size prints differently once it is distributed is that the report’s paper size ID (Form ID) is saved with the report file. It is the ID value that is saved and not the name of the paper size because the Crystal Reports print engine uses the operating system's DEVMODE structure to save the printer information with the report. This is by design, and affects all Crystal Reports development tools.

To pass a custom paper size ID to a report using the Crystal Reports Designer Component, use the following code:

rpt.PaperSize = 133

To pass a custom paper size ID to a report using Visual Studio .NET, use the following code:

rpt.PrintOptions.PaperSize = CType(133, CrystalDecisions.Shared.PaperSize)
Even if the custom paper size ID is passed to the report in code, the report may still print differently when distributed.

The DEVMODE structure contains the ID value of the paper size, not the name. Therefore, when the application is deployed to another computer, the custom paper size ID is not the same as it was on the development computer. This custom paper size ID may be a different number on every computer it is deployed to.

To resolve this issue, the application needs to determine the custom paper size ID based on the name of the Form, then pass that Form ID to Crystal Reports.

For more information on determining the Form ID, go to and search for q132239.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top