Click here to Skip to main content
14,428,429 members
Rate this:
Please Sign up or sign in to vote.
See more:

I am trying to print on a custom sized paper but the printer doesn't pick the default setting of the printer, therefore during printing the paper is Letter. I have created a new form from

Open Printers from Control Panel.
Select the Dot Matrix Printer and Make it as Default Printer;
Keep it selected and Click on menu : File - Server Properties
Check option : Create New Form.
Give appropriate name say "A6 LR" and Give Height and width
Save the Form

Below is my code

cmd.CommandText = ("SELECT * FROM Sales)
 rptDoc = New CrystalSales
 cmd.Connection = Con
 DA.SelectCommand = (cmd)
 DA.Fill(DSRpt, cmd.CommandText)
 DTRpt = DSRpt.Tables(0)
 frmRptViewer.Text = "Sales Order Report"
 frmRptViewer.CrystalReportViewer1.ReportSource = rptDoc
 rptDoc = Nothing

I need to show the report before printing because the report can be more than 1 page. Is there a way either through codes I use the printers default setting or change the paper size at runtime?

Thank you and you help will be highly appreciated.
Updated 7-Aug-12 0:21am
What is CR? :-)
bbirajdar 6-Aug-12 12:47pm
I guess he means 'Crystal Reports'....But is too lazy to type the complete name and expects us to decode his question and provide a answer :)
Thank you very much. I don't think abbreviation like that are acceptable...
Member 8508076 7-Aug-12 5:23am
Sorry about that.

I have changed CR to Crystal Reports, now can anyone please help me?

Thank you.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

May i know what type of document you are going to print. If its like Invoice or Bill then you can't use crystal report. you should use text printing. Before that please let me know what type of document you are going to print.

Thanks and Regards
Arun Vasu
Member 8508076 7-Aug-12 6:06am
Hi Arun,

It is a receipt which has to be printed on pre-printed stationary. That is why I used crystal reports so that I can align the fields to fit into the pre-printed stationary.

So far it works well but the only problem I am facing is that, when I want to print the receipt, I have to manually change the print preference, select the correct paper size then print.

If I can programmatically select the paper size before printing that will be very helpful.

Thank you.
Member 8508076 8-Aug-12 5:39am

No one can help me with this issue?


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100