如何在使用打印机对象时停止在vb中弹出纸张 [英] How to stop paper ejecting in vb while using printer object

查看:59
本文介绍了如何在使用打印机对象时停止在vb中弹出纸张的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用计费软件.
票据打印后,整个卷纸都被弹出(点阵).

引导我停止通过c#弹出纸张.

I am doing billing software.
After bill print whole roll paper is ejected (dot matrix).

Guide me to stop eject paper through c#.

推荐答案

在VB或C#中?(您的问号和标题均显示)

我总是讨厌点矩阵打印问题X |无论如何,我会给你一堆,检查一下!

VB 2008卷纸打印法案 [在打印机上弹出页面 [如何动态控制纸张(进纸)而无需在SDR上弹出纸张,在具有卷纸的点阵打印机上打印 [^ ]
停止使用打印后弹出剩余空间VB 6.0 [ ^ ]
如何避免纸张弹出 [ ^ ]

免费附件
还有一篇适合您的好文章
.NET文本打印类. . [ ^ ]

请自己将VB代码转换为C#.顺便说一句,我认为您很幸运(有很多与此相关的链接)
In VB or C#?(Your Question Tag & title shows both)

I''m always sick of dot matrix printing issues X| Anyway I''ll give you a bunch, check it!

VB 2008 print bill on roll paper[^](OP solved himself)
page ejecting on printer[^]
How to dynamic control paper (feed) without eject paper on SDR, printing on dot matrix printer with roll paper[^]
Stop ejecting remaining space after printing using VB 6.0[^]
How to avoid paper ejection[^]

Free attachment
And a nice article for you
A .NET Text Printing Class... That Works![^]

Please convert the VB code into C# yourself. BTW I think you are lucky(got many links regarding this)


http://support.microsoft.com/?kbid=322091
http://support.microsoft.com/?kbid=322091


使用系统;
使用System.Collections.Generic;
使用System.ComponentModel;
使用System.Data;
使用System.Drawing;
使用System.Text;
使用System.Windows.Forms;
使用System.IO;
使用System.Drawing.Printing;
使用System.Data.SqlClient;


命名空间PrintApp
{
公共局部类Form1:Form
{
私有PrintDocument printDocument1 =新的PrintDocument();
私有字符串stringToPrint;
int cntng;
公共Form1()
{
InitializeComponent();
printDocument1.PrintPage + =新的PrintPageEventHandler(printDocument1_PrintPage);

}

private void button1_Click(对象发送者,EventArgs e)
{
字符串查询= Application.StartupPath +"\\ text.txt";
使用(StreamWriter sw = new StreamWriter(Application.StartupPath +"\\ text.txt"))
{
sw.WriteLine("BILL WISE PROTIT REPORT");
}
ReadFile();
printDocument1.Print();



}
私有void ReadFile()
{

使用(StreamReader sr = new StreamReader(Application.StartupPath +"\\ text.txt"))
{
cntng = File.ReadAllLines(Application.StartupPath +"\\ text.txt").Length;
for(int i = 0; i< cntng; i ++)
{

stringToPrint = sr.ReadToEnd();

}

}

}

私有void printDocument1_PrintPage(对象发送者,PrintPageEventArgs e)
{
int charactersOnPage = 0;
int linesPerPage = 0;
字体printfont =新字体("TAMKural",10);
e.Graphics.MeasureString(stringToPrint,printfont,
e.MarginBounds.Size,StringFormat.GenericTypographic,
out charactersOnPage,outlinesPerPage);
e.Graphics.DrawString(stringToPrint,printfont,Brushes.Black,
e.MarginBounds,StringFormat.GenericTypographic);
stringToPrint = stringToPrint.Substring(charactersOnPage);

e.HasMorePages =(stringToPrint.Length> 0);



}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Printing;
using System.Data.SqlClient;


namespace PrintApp
{
public partial class Form1 : Form
{
private PrintDocument printDocument1 = new PrintDocument();
private string stringToPrint;
int cntng;
public Form1()
{
InitializeComponent();
printDocument1.PrintPage+=new PrintPageEventHandler(printDocument1_PrintPage);

}

private void button1_Click(object sender, EventArgs e)
{
string query = Application.StartupPath + "\\text.txt";
using (StreamWriter sw = new StreamWriter(Application.StartupPath + "\\text.txt"))
{
sw.WriteLine("BILL WISE PROFIT REPORT");
}
ReadFile();
printDocument1.Print();



}
private void ReadFile()
{

using (StreamReader sr = new StreamReader(Application.StartupPath + "\\text.txt"))
{
cntng = File.ReadAllLines(Application.StartupPath + "\\text.txt").Length;
for (int i = 0; i < cntng; i++)
{

stringToPrint = sr.ReadToEnd();

}

}

}

private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
{
int charactersOnPage = 0;
int linesPerPage = 0;
Font printfont = new Font("TAMKural", 10);
e.Graphics.MeasureString(stringToPrint, printfont,
e.MarginBounds.Size, StringFormat.GenericTypographic,
out charactersOnPage, out linesPerPage);
e.Graphics.DrawString(stringToPrint, printfont, Brushes.Black,
e.MarginBounds, StringFormat.GenericTypographic);
stringToPrint = stringToPrint.Substring(charactersOnPage);

e.HasMorePages = (stringToPrint.Length > 0);



}
}
}


这篇关于如何在使用打印机对象时停止在vb中弹出纸张的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆