开发者

Printing with dot matrix printers via C# programming

开发者 https://www.devze.com 2023-01-25 05:30 出处:网络
I am using the code template from Microsoft at this site with this snippet to print out only a single line and form feed:

I am using the code template from Microsoft at this site with this snippet to print out only a single line and form feed:

string s = "Hello world!\xC"; //\xC means form feed
PrintDialog pd = new PrintDialog();
pd.PrinterSettings = new PrinterSettings();
if (Dial开发者_C百科ogResult.OK == pd.ShowDialog(this))
{
    RawPrinterHelper.SendStringToPrinter(pd.PrinterSettings.PrinterName, s);
}

But no luck, my paper size long is always like A4 paper size long.

What is wrong with my code? Do anyone got a hint or trick to deal with this problem?


It's hard to say what the problem might be. SendStringToPrinter ultimately ends up calling WritePrinter, which is supposed to copy what you send it to the printer unchanged. A form feed is supposed to advance the paper vertically to the beginning of the next page. "Next page" in this case is defined by the printer, and the printer's configuration will say how long a page is.

Are you perhaps wanting to advance just one line by using a line feed?

0

精彩评论

暂无评论...
验证码 换一张
取 消