Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 票据上热敏打印机顶部的空白区域_C#_Printing_Crystal Reports_Report - Fatal编程技术网

C# 票据上热敏打印机顶部的空白区域

C# 票据上热敏打印机顶部的空白区域,c#,printing,crystal-reports,report,C#,Printing,Crystal Reports,Report,我正在尝试为我的POS应用程序创建一个KOT,一切正常,但出于某种原因,账单顶部有一个奇怪的空间,这个空间大小固定为15厘米,如果我使用visual studio从主报告视图打印报告,而不运行应用程序,则通常打印时没有空格,但是,如果我试图从运行的应用程序打印账单,我总是在顶部得到15厘米的空白,我试图在正常打印账单之前,从我构建的另一个应用程序打印账单。 我在网上搜索时尝试了不同的方法,但我无法解决这个问题 我正在使用此代码打印账单: KOT Rtp = new KOT

我正在尝试为我的POS应用程序创建一个KOT,一切正常,但出于某种原因,账单顶部有一个奇怪的空间,这个空间大小固定为15厘米,如果我使用visual studio从
主报告视图打印报告,而不运行应用程序,则通常打印时没有空格,但是,如果我试图从运行的应用程序打印账单,我总是在顶部得到15厘米的空白,我试图在正常打印账单之前,从我构建的另一个应用程序打印账单。
我在网上搜索时尝试了不同的方法,但我无法解决这个问题

我正在使用此代码打印账单:

            KOT Rtp = new KOT();
        if (Rtp.DataDefinition.ParameterFields.Count > 0)
        {
            foreach (ParameterFieldDefinition crDef in Rtp.DataDefinition.ParameterFields)
            {
                if (crDef.ReportName == string.Empty)
                {
                    object objValue = "16";
                    Rtp.SetParameterValue(crDef.ParameterFieldName, objValue);
                }
            }
        }

        ConnectionInfo crConn = new ConnectionInfo();
        crConn.ServerName = Properties.Settings.Default.server;
        crConn.DatabaseName = Properties.Settings.Default.database;
        crConn.UserID = Properties.Settings.Default.user;
        crConn.Password = Properties.Settings.Default.password;
        // get the Report Tables
        Tables crTables = Rtp.Database.Tables;

        // get the Report Tables
        _ = Rtp.Database.Tables;
        for (int i = 0; i < crTables.Count; i++)
        {
            Table crTable = crTables[i];
            TableLogOnInfo tblInfo = crTable.LogOnInfo;
            tblInfo.ConnectionInfo = crConn;
            crTable.ApplyLogOnInfo(tblInfo);
        }
        // then display the Report - here I am using a Crystal Reports Viewer in a Windows Form
        //var frm = new Form1();
        //frm.CrystalReportViewer1.ReportSource = Rtp;
        //frm.ShowDialog();

        CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions popt = new CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions();
        popt.PrinterName = "SGT-88IV Printer(2)";
        Rtp.ReportClientDocument.PrintOutputController.PrintReport(popt);
KOT Rtp=new KOT();
如果(Rtp.DataDefinition.ParameterFields.Count>0)
{
foreach(Rtp.DataDefinition.ParameterFields中的ParameterFieldDefinition crDef)
{
if(crDef.ReportName==string.Empty)
{
对象objValue=“16”;
Rtp.SetParameterValue(crDef.ParameterFieldName,objValue);
}
}
}
ConnectionInfo crConn=新的ConnectionInfo();
crConn.ServerName=Properties.Settings.Default.server;
crConn.DatabaseName=Properties.Settings.Default.database;
crConn.UserID=Properties.Settings.Default.user;
crConn.Password=Properties.Settings.Default.Password;
//获取报告表
Tables crTables=Rtp.Database.Tables;
//获取报告表
_=Rtp.Database.Tables;
对于(int i=0;i
这是我从应用程序打印时收到的账单:

这是我在VisualStudio的主报告预览中打印时收到的账单:

这是我的页面设置:

我通过转到打印机设置并将“高级选项”中的纸张大小从
打印机80(72mmx800mm)
更改为
打印机80(72mmx210mm)
解决了问题。

我通过转到打印机设置并将“高级选项”中的纸张大小从
打印机80(72mmx800mm)
更改为
打印机80(72mmx210mm)
解决了问题。