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~
Edited by: Brian Lau on Sep 2, 2008 5:57 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
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()
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
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:
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?
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.