Crystal report: resizing papersize

Hello!

I am having a problem resizing the papersize of the report with my desired dimensions which is 13"x17" or any other dimensions for that matter.

Need your expertise guys ..

Thanks!!

[266 byte] By [goozbee] at [2007-12-16]
# 1
Hello,

What exactly is your problem? Which version of Crystal Reports are you working with?

Crystal Reports picks up the paper size from the printer that you have the report bound to. So the paper size will first need to be available from the printer setup in Windows. In Windows XP go to Start|Printers and Faxes and make sure that the printer you are using has the 13"x17" available.

Now for the embedded report designer in Visual Studio .NET, you would right click on the report surface to bring up the context menu and select Designer|Page Setup. From here select the appropriate printer and paper size.

Keith - Business Objects

KeithThomson at 2007-9-9 > top of Msdn Tech,Visual Studio,Crystal Reports for Visual Studio...
# 2
I am having a little of problem with this, I am using a custom papersize, I configured the report correctly and it works perfectly on the computer I compile the application, but if I run the application on another computer, even though it has the same printer and paper sizes, it will aways print on A4.
I am not sure at all what is the problem, using CrystalReportViewer or printing with the PrintToPrinter method, it will lose the paper size previously configured and use A4.

Any help will be greatly appreciated.

Realgar at 2007-9-9 > top of Msdn Tech,Visual Studio,Crystal Reports for Visual Studio...
# 3

Hello

I have the very same problem too! Followed all the hint from Cystal Decision's support website (used PrintToPrinter Method too) but nothing change!

If anyone has a good solution or some ideas please share it! :)

Thanks

StefanoCrosatti at 2007-9-9 > top of Msdn Tech,Visual Studio,Crystal Reports for Visual Studio...
# 4

I have managed to print with any paper settings.
Unfortunately I found NO way to do it with code.
It′s a lot about configuring your windows.

In the windows that will print, you have to configure your printer with the paper settings you want to use. If the form you want doesn′t exist, create it, and set the printer default with it, it′s important to set the custom paper size as printer default, so you can set the crystal size as the printer default.

If you are going to print an custom paper size, I discovered a bug with Crystal Reports...
If you change the printer name of a report, it will screw your configuration
So what I do is instantiate another Crystal Report to keep my page size.
This is not needed if you are using one the Crystal default paper sizes. (From CrystalDecisions.Shared.PaperSize)

MYCRYSTALREPORT crpt = new MYCRYSTALREPORT();

crpt.SetDataSource(SOMEDATASET);

MYCRYSTALREPORT crpt2 = crpt; //crpt2 will only keep page size

crpt.PrintOptions.PrinterName = "PRINTERNAME";

crpt.PrintOptions.PaperSize = crpt2.PrintOptions.PaperSize;

crpt.PrintToPrinter(1,false,0,0);

Realgar at 2007-9-9 > top of Msdn Tech,Visual Studio,Crystal Reports for Visual Studio...
# 5

Hey, thanks a lot!

I'm going to try it just now, however, JFYI here it is the code I use:

Dim oRpt As New rptMyReport()

oRpt.SetDataSource(dsMyDataset)

Dim margins As PageMargins

' Get the PageMargins structure and set the

' margins for the report.

margins = oRpt.PrintOptions.PageMargins

margins.bottomMargin = 0

margins.leftMargin = 0

margins.rightMargin = 0

margins.topMargin = 0

' Apply the page margins.

oRpt.PrintOptions.ApplyPageMargins(margins)

oRpt.PrintOptions.PrinterName = "Epson SQ-1170 ESC/P 2"

oRpt.PrintOptions.PaperSource = PaperSource.Tractor

crSubReportDocument1 = oRpt.OpenSubreport("rptMyReport2.rpt")

crSubReportDocument1.SetDataSource(dsMyDataset2)

crSubReportDocument1.PrintOptions.ApplyPageMargins(margins)

CrystalReportViewer1.ReportSource = oRpt

CrystalReportViewer1.Zoom(65)

StefanoCrosatti at 2007-9-9 > top of Msdn Tech,Visual Studio,Crystal Reports for Visual Studio...
# 6

Just tried.

Unfortunately the situation is the same.

On my pc, where I designed the report, it's all ok.

On the end-users pcs I've followed this procedure:

Since the printer is connected to the LAN via a standard LPR print server I installed on all the pcs the Epson printer like a local printer using a standard TCP/IP port.Then ,on every pc, I created the custom paper format and I've set the standard format for the printer as my custom format.

On 1 pc it work as expected.

On another 1, no matter how I change the settings or I use your trick, or use the PrintToPrinter Method, the report is always rendered using the A4 format.

I'm going crazy!

Any help will be appreciated.

StefanoCrosatti at 2007-9-9 > top of Msdn Tech,Visual Studio,Crystal Reports for Visual Studio...
# 7
Post your code if you can..

Are you using your printer like \\printservername\printername ?

And make sure the paper available on the printer property is the custom paper you want to print on.

Realgar at 2007-9-9 > top of Msdn Tech,Visual Studio,Crystal Reports for Visual Studio...
# 8

The code I used is already there, look my previous post :)

However I solved the problem!

I can't believe CR is acting in such a (stupid) way!

The fact is that crystal report save the information of the format of a report in a non-portable way!
It saves the "ID" of the format instead of his "Name"!
The problem is that in Windows this ID is machine dependent.

The trick is very simple:

1 - Search on the system for the printer you want to use.

2 - Cycle over all the supported format searching for your custom format (I search it by name but you can search it also by dimensions (in inches)).

3 - Get the ID.

4 - Assign it to the report's PaperSize property.

5 - Bingo!

Here it is a quick example:

Dim doctoprint As New System.Drawing.Printing.PrintDocument()
doctoprint.PrinterSettings.PrinterName = "YourPrinterName" '(ex. "Epson SQ-1170 ESC/P 2")
For i = 0 To doctoprint.PrinterSettings.PaperSizes.Count - 1
Dim rawKind As Integer
If doctoprint.PrinterSettings.PaperSizes(i).PaperName = "MyCustomFormatName" Then
rawKind = CInt(doctoprint.PrinterSettings.PaperSizes(i).GetType().GetField("kind", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic).GetValue(doctoprint.PrinterSettings.PaperSizes(i)))
oRpt.PrintOptions.PaperSize = rawKind
Exit For
End If
Next

Hope it helps!

Cheers

Stefano

StefanoCrosatti at 2007-9-9 > top of Msdn Tech,Visual Studio,Crystal Reports for Visual Studio...
# 9
hi Stefano Crosatti,
I hv tried ur method and got success. Thank you very much.

Regards
Shan.

Shantnj at 2007-9-9 > top of Msdn Tech,Visual Studio,Crystal Reports for Visual Studio...
# 10

i have a directory list which i need to print in a booklet (100 copies).

i need to export my CR data to a pdf file and bring the pdf file to a printing office. how do i resize the page from 8.5x11 to 5.5x8.5 (half the size) before printing?Can i set the size 5.5x8.5 before exporting the list to a pdf file or do i set it before printing?either way,how?

Thanks in advance,

Adrian

adrian3894 at 2007-9-9 > top of Msdn Tech,Visual Studio,Crystal Reports for Visual Studio...
# 11
actually u can use the method that gv by Stefano Crosatti but setting the cr page size first it will generate the page size like u require. Then u can export it out into PDF and print it
angel180 at 2007-9-9 > top of Msdn Tech,Visual Studio,Crystal Reports for Visual Studio...

Visual Studio

Site Classified