cancel
Showing results for 
Search instead for 
Did you mean: 

How to use "CrystalDecisions.Shared.PrintLayoutSettings" in .NET

Former Member
0 Kudos

Hi, All

My report is printed in the center of the paper as the PrintLayoutSettings.centered = true.

I would like to set the centered property to false when printing the report with PrintToPrinter() method. How can I do so? I am using VB.NET

Thank you very much~

Br,

Brian Lau

Edited by: Brian Lau on Sep 2, 2008 5:57 PM

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

I suspect I don't understand your query, but what happens if you set PrintLayoutSettings.centered = false?

Does that not work?

Can you provide the full code used?

Explain a bit more as to what it is you are trying to achieve?

Ludek

Former Member
0 Kudos

Hi, Ludek

Thanks for your reply!

Let me explain in more detail.

I am implementing a food ordering application and I need to print receipt with a Star TSP700 thermal printer.

The paper size of the printer driver is chosen as "80mmxReceipt". The paper size of the crystal report is set as "80mm x 400mm" because the height must be set with a finite integer. There is no way to set "80mm x Receipt".

The problem is when the receipt is print by printToPrinter() method, the receipt content is shifted down to the center of the paper, i.e. the upper side of the printed receipt is blank. The printed content is shifted down around 20cm....

Actually, I don't know how to apply the PrintLayoutSettings to the report.

Here is the code segment that print the receipt:

'/////////////////////////////////////////////////////////////

'Create an instance of the report to be printed

Dim rptReceipt As New ReceiptReport

'Prepare the dataset for the report

Dim ds as Dataset = getReportDataset()

rptReceipt.SetDataSource(ds)

Dim oLayout As New CrystalDecisions.Shared.PrintLayoutSettings

oLayout.Centered = False

oLayout.Scaling = PrintLayoutSettings.PrintScaling.DoNotScale

rptReceipt.PrintToPrinter(1, False, 0, 0)

'////////////////////////////////////////////////////////////////

Edited by: Brian Lau on Sep 4, 2008 3:59 AM

former_member183750
Active Contributor
0 Kudos

Great stuff. Excellent information.

First thing. I suspect you are using CR 2008(?). If that is the case, I'd like you to download SP0 for CR 2008 from here:

https://smpdl.sap-ag.de/~sapidp/012002523100007528552008E/cr2008_sp0.zip

Next. I understand you are passing a dataset to the report and that is fine. However, I'd like to know how the report was created in the CR designer? E.G.; did you use a connection to a database, or to and XML file or? And, can you print the report to that printer with good result from the CR designer?

Ludek

Former Member
0 Kudos

Hi, Ludek

Yes, I am using CR 2008.

The report was created in Visual Studio 2005 with a dataset defined in my project.

When using CrystalReportViewer in .NET, I can print the report normally (without shifting down to center) only if the "center the page" checkbox in "layout" tab page is un-checked.

I guess it is the problem of the "center the page" property of the crystal report engine when using printToPrinter() method directly... as the printout result is the same as that of the situation when printed from CrystalReportViewer and "center the page" checkbox is checked.

Br,

Brian Lau

Answers (0)