简体   繁体   English

PowerShell 在爱普生打印机上设置默认纸张尺寸的脚本

[英]PowerShell Script to set default paper size on an Epson Printer

Epson printers, by default, have a paper size of 80mm x 297mm (or something close to 297)默认情况下,爱普生打印机的纸张尺寸为 80mm x 297mm(或接近 297)

The datawindow in my program is longer than that, so it prints a second page and duplicates the header.我程序中的数据窗口比那个长,所以它打印第二页并复制 header。

If you go into the printer properties and set the paper length to 80mm x 2970mm then everything works fine.如果您 go 进入打印机属性并将纸张长度设置为 80mm x 2970mm,则一切正常。

I am trying to write a powershell script that will automate this process.我正在尝试编写一个 powershell 脚本来自动执行此过程。

The Printer Name is "EPSON TM-T20IIIL Receipt" and the Paper Size Value that I want it to be set to is "Roll Paper 80 x 3276 mm"打印机名称为“EPSON TM-T20IIIL Receipt”,我希望将其设置为“卷纸 80 x 3276 毫米”的纸张尺寸值

EDIT This is a roll receipt printer编辑这是卷收据打印机

This seems like it would work for a regular printer that has a PaperSize Value of A0-A10.这似乎适用于 PaperSize 值为 A0-A10 的普通打印机。 The problem Im facing is that the Epson Roll Receipt printer does not have any of these values.我面临的问题是 Epson Roll Receipt 打印机没有任何这些值。 Is there a corresponding value to the size I'm looking for?是否有与我要查找的尺寸对应的值? Set-PrintConfiguration -PrinterName "EPSON TM-T20IIIL Receipt" -PaperSize A4

Printer size options available [1]: https://i.stack.imgur.com/Fo0AY.png可用的打印机尺寸选项 [1]: https://i.stack.imgur.com/Fo0AY.png

Since Epson receipt printers are not what I would say are "normal" printers, you can't use typical Windows print settings to set these values.由于爱普生收据打印机不是我所说的“普通”打印机,因此您不能使用典型的 Windows 打印设置来设置这些值。 When printing, you basically only send text and basic commands to the printer.打印时,您基本上只向打印机发送文本和基本命令。 Most of the configuration settings are actually stored in the Flash memory on the printer and not in the driver.大多数配置设置实际上存储在打印机上的 Flash memory 中,而不是驱动程序中。 For ex.对于前。 the logos at the start of a receipt is stored on the printer, and not generated at all by the driver.收据开头的徽标存储在打印机上,根本不是由驱动程序生成的。 Similarly, options for automatically cutting paper at the end of printing.同样,打印结束时自动裁纸的选项。 I believe that paper/roll size falls under these kind of settings because the printer needs to know the width of the paper to know how to handle the text being sent to it (remember, we are only sending basic raw text to the printer, and the printer determines how to print it).我相信纸张/卷筒尺寸属于此类设置,因为打印机需要知道纸张的宽度才能知道如何处理发送给它的文本(请记住,我们只向打印机发送基本的原始文本,并且打印机决定如何打印它)。

Therefore to configure the printer, while the basic driver is needed, you actually have to use the Epson Advanced Printer Driver to configure the printer, and then use APD to export the configuration.因此配置打印机,虽然需要基本的驱动程序,但实际上必须使用Epson Advanced Printer Driver配置打印机,然后使用APD导出配置。 That exported configuration can be used to set up new printers.导出的配置可用于设置新打印机。 For ex.对于前。 using APD v5 driver.使用 APD v5 驱动程序。

  1. First install and fully configure the printer with all the configurations that you want.首先安装并使用您想要的所有配置完全配置打印机。 (paper/roll sizes, logos, cut/no cut at end of print, etc.) (纸张/卷筒尺寸、徽标、打印结束时裁切/不裁切等)
  2. Export the configuration by running Start -> All Programs -> EPSON -> EPSON Advanced Printer Driver 5 and open Register, Change and Delete EPSON TM Printer通过运行Start -> All Programs -> EPSON -> EPSON Advanced Printer Driver 5导出配置并打开Register, Change and Delete EPSON TM Printer
  3. Select the printer, and from the menu select Copy Installation -> Create Select 打印机,并从菜单 select Copy Installation -> Create
  4. Select the installation package type. Select 安装 package 类型。 eg I suggest Complete package (with the APD Utility)例如,我建议Complete package (with the APD Utility)

Now you can use that installation package to install a fully configured printer on any new machines.现在您可以使用该安装 package 在任何新机器上安装完全配置的打印机。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM