How to change advanced printing preferences via .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. 开发者_JAVA百科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
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.
精彩评论