如何通过.NET 更改高级打印首选项?
我正在使用 .NET Printing 命名空间通过 Postscript 打印机将文档打印到文件,如下所示:
- 创建 .NET
System.Drawing.Printing.PrinterSettings
类 - 集
PrinterName
、PrintFileName
和DefaultPageSettings
(PaperSize
、PrinterResolution
等)。 - 创建
PrintDocument
类的实例并分配PrinterSettings
实例 - 调用
Print
方法,该方法调用我的自定义处理程序来执行打印
如果可能,我还需要以编程方式修改打印机特定设置。如果我右键单击打印机(在 Windows 7 中)并选择“打印首选项”,然后选择“高级...”,我会看到以下选项
Document Options
--PostScript Options
----PostScript Output Option
----TrueType Font Download Option
----PostScript Language Level
----etc.
--Printer Features
----PDF Settings
----PDF Compatibility
----EmbedAllFonts
----etc.
:通过 .Net 设置(或至少确认)这些自定义属性?如果没有,是否有其他方法(例如,通过注册表......虽然我在那里没有找到这些选项)?
谢谢
I am using the .NET Printing namespace to print a document to file through a Postscript printer as follows:
- create instance of the .NET
System.Drawing.Printing.PrinterSettings
class - set
PrinterName
,PrintFileName
, andDefaultPageSettings
(PaperSize
,PrinterResolution
, etc.). - create an instance of the
PrintDocument
class and assign thePrinterSettings
instance - Invoke the
Print
method which calls my custom handler to do the printing
If possible, I also need to programmatically modify printer specific settings as well. If I right-click on the printer (in Windows 7) and select "Printing preferences" then "Advanced..." I have the following options:
Document Options
--PostScript Options
----PostScript Output Option
----TrueType Font Download Option
----PostScript Language Level
----etc.
--Printer Features
----PDF Settings
----PDF Compatibility
----EmbedAllFonts
----etc.
Is there a way to set (or at least, confirm) these custom properties via .Net? If not, is there another way (such as, through the registry... although I did not find these options there)?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,我认为你不能做到这一点。您看到的高级设置是 Windows 附带的 Postscript 打印机驱动程序的一部分。这些旨在由最终用户修改,并且是驱动程序私有设置的一部分。 Postscript 驱动程序提供了一个插件接口,您可以通过该接口访问 API 并对所有这些设置进行更改。请参阅这些链接 - http://msdn。 microsoft.com/en-us/library/ff561832%28v=VS.85%29.aspx、http://msdn.microsoft.com/en-us/library/ff563612%28v=VS.85%29.aspx。
如果您可以告诉我您想要修改哪种打印机设置,我可以提供其他输入。例如:可以修改打印机驱动程序公共开发模式中的设置(如方向、纸张尺寸等)。
Unfortunately, I dont think you can do that. The Advanced Settings you see is part of the Postscript Printer driver that comes along with Windows. These are meant to be modified by the end user and is part of the private settings of the Driver. The Postscript driver provides a plug-in interface thru which you can get access to APIs and make the changes to all these settings. Refer to these links - http://msdn.microsoft.com/en-us/library/ff561832%28v=VS.85%29.aspx, http://msdn.microsoft.com/en-us/library/ff563612%28v=VS.85%29.aspx.
If you can tell me what kind of printer settings you want to modify, I could provide additional input. For eg: settings that are in the public devmode of a printer driver (like orientation, paper size etc) are possible to modify.