2
votes

I just want to print a bill in half of A4 size paper i.e. Width: 8.269 inches, Height: 5.847 inches. I have tried several times with different settings. It gets the size, but the problem is it is printing in landscape orientation. Just like the picture below.

enter image description here

Even after a massive search, I am unable to get the answer of my question. When I am writing my question, stackoverflow gave me some answer suggestions.

Like this.

But how can I get the client's printer setup in my development pc ? Is it not like generic that works fine in all printers ? If client change the printer for any reason, it will be a mess right ?

In this question, the problem persists and the question was not solved.

As per the answer of this question, I tried this process before, but failed.

I have written to SAP. They answered me with a link of a file and stated it could solve my problem. I found it is a c# code where I am using vb.net. I can understand the code, but I am unable to understand from where to start.

I always use crystal reports

  1. directly to the printer.....

        Dim stdata As New DataSet()
        dbcommand.Connection = conn
        dbcommand.CommandText = qry
        dbadapter.SelectCommand = dbcommand
        dbadapter.Fill(stdata)
        stdata.WriteXml(Application.StartupPath & "\ReportXml\bill.xml", XmlWriteMode.WriteSchema)
    
        Dim objRpt As New NormalSaleBill
        objRpt.SetDataSource(stdata.Tables(0))
        Dim printPages As Integer = G_DefaultPrintPages '<--- A variable with print page count 
        objRpt.PrintToPrinter(printPages, True, 0, 0)
    

or

  1. with report viewer...

            Dim stdata As New DataSet()
        dbcommand.Connection = conn
        dbcommand.CommandText = qry
        dbadapter.SelectCommand = dbcommand
        dbadapter.Fill(stdata)
        stdata.WriteXml(Application.StartupPath & "\ReportXml\SaleBill.xml", XmlWriteMode.WriteSchema)
    
        Dim objRpt As New NormalSaleBill
        objRpt.SetDataSource(stdata.Tables(0))
    
        FormReport.RptViewer.ReportSource = objRpt
        FormReport.ShowDialog()
        FormReport.RptViewer.RefreshReport()
    

So where should I put the custom paper/page size (If it can only be done programatically) ?

I am totally confused. I need it badly, but I am unable to resolve it. I do not want any ready-made code. But at least a guide could help me.

For your information, I am using VB.NET 2010 with Crystal Report 13.

2
shouldnt you be doing that in the report itself under the Design -> Page Setup?? Also you say it always prints in Landscape, but your first image is Portrait?? Is it the other way round? have you changed orientation to what is needed in Page Setup? Also there is Margins setting that you can set to 0..aMazing
@aMazing I have tried the Design-->Page Setup. I changed the orientation into potrait, but it prints like the above image.Raja
Dont you want to change it to Landscape?aMazing
Might be due to Printer's default settings see my answer hereMyk Agustin

2 Answers

0
votes

I Have the same problem and I resolved this with the following steps. the problem occurs due to a width greater than height. Due to that automatically rotate paper as landscape.

1.Create custom size paper in your printer

enter image description here

2.Crystal Reports--> Design-->Page Setup

Select your Printer with custom size paper and set orientaion.

Print!!!

enter image description here

-1
votes

Try size A3 in portrait and adjust your top and bottom margins