Here's my situation:
这是我的情况:
- I'm developing a C# add-in for a 3rd party program
- This program (Revit) uses its own printing methods and exposes them through its API
- I am writing a printing utility that uses these methods to print to various locations, including a PDF printer
- I'm using PDF995 as a printer and modifying its .ini file to automate it.
- Basically I'm calling the print method in the API which prints the active drawing to a specified printer.
我正在为第三方程序开发一个C#加载项
该程序(Revit)使用自己的打印方法并通过其API公开它们
我正在编写一个打印实用程序,它使用这些方法打印到各种位置,包括PDF打印机
我正在使用PDF995作为打印机并修改其.ini文件以使其自动化。
基本上我在API中调用print方法,它将活动图形打印到指定的打印机。
My problem is that on PDF995, if you go to printing preferences in Windows the orientation is by default set to 'portrait'. I need landscape. These settings seem to override anything I set in the Revit API, so I need a way of changing the windows settings.
我的问题是,在PDF995上,如果你转到Windows中的打印首选项,默认情况下,方向设置为“纵向”。我需要风景。这些设置似乎覆盖了我在Revit API中设置的任何内容,因此我需要一种更改Windows设置的方法。
I've tried this code:
我试过这段代码:
PrintDocument printDocument = new PrintDocument();
printDocument.PrinterSettings.PrinterName = "PDF995";
printDocument.DefaultPageSettings.Landscape = true;
before calling the print function in the API, but it makes no difference. I can't see a way to edit the pdf995 ini to set these settings either. It's a windows setting that I need to override.
在调用API中的print函数之前,它没有任何区别。我看不到编辑pdf995 ini来设置这些设置的方法。这是我需要覆盖的Windows设置。
I've seen some C++ code on the net I can call to do things with printers but can't find an example of changing the default settings.
我在网上看到了一些C ++代码我可以调用打印机来做事情,但找不到更改默认设置的示例。
Can anyone point me in the right direction?
谁能指出我正确的方向?
2 个解决方案
#1
I've had good success using these components:
我使用这些组件取得了很大的成功:
http://www.merrioncomputing.com/Download/PrintQueueWatch/index.htm http://printqueuewatch.codeplex.com/Wiki/View.aspx?title=Home
This collection makes available all sorts of useful printing options. It's mainly focused on monitoring a print queue, but from memory there are options available to change printer settings and job properties.
此系列提供各种有用的打印选项。它主要侧重于监视打印队列,但是从内存中可以选择更改打印机设置和作业属性。
#2
I think many of the settings from a use of Autodesk.Revit.DB.PrintManager are "placeholders", but that if the printer is controlling these settings, the value ported to it by Revit is ignored. I have tried setting .PrintToFileName with a full path, but making a PDF in BlueBeam still sends the file to MyDocuments, from where I have to copy it. Have you tried copying your PDF995 to PDF995X (for example) and modifying it to have a default of Landscape (while PDF995 retains the default of Portrait)? I have used this method in the past when a printer insists on using stored defaults instead of those requested.
我认为使用Autodesk.Revit.DB.PrintManager的许多设置都是“占位符”,但是如果打印机控制这些设置,则忽略Revit移植到它的值。我尝试使用完整路径设置.PrintToFileName,但在BlueBeam中制作PDF仍然会将文件发送到MyDocuments,我必须从中复制它。您是否尝试将PDF995复制到PDF995X(例如)并将其修改为默认为横向(而PDF995保留默认的纵向)?我曾经使用过这种方法,因为打印机坚持使用存储的默认值而不是请求的默认值。
#1
I've had good success using these components:
我使用这些组件取得了很大的成功:
http://www.merrioncomputing.com/Download/PrintQueueWatch/index.htm http://printqueuewatch.codeplex.com/Wiki/View.aspx?title=Home
This collection makes available all sorts of useful printing options. It's mainly focused on monitoring a print queue, but from memory there are options available to change printer settings and job properties.
此系列提供各种有用的打印选项。它主要侧重于监视打印队列,但是从内存中可以选择更改打印机设置和作业属性。
#2
I think many of the settings from a use of Autodesk.Revit.DB.PrintManager are "placeholders", but that if the printer is controlling these settings, the value ported to it by Revit is ignored. I have tried setting .PrintToFileName with a full path, but making a PDF in BlueBeam still sends the file to MyDocuments, from where I have to copy it. Have you tried copying your PDF995 to PDF995X (for example) and modifying it to have a default of Landscape (while PDF995 retains the default of Portrait)? I have used this method in the past when a printer insists on using stored defaults instead of those requested.
我认为使用Autodesk.Revit.DB.PrintManager的许多设置都是“占位符”,但是如果打印机控制这些设置,则忽略Revit移植到它的值。我尝试使用完整路径设置.PrintToFileName,但在BlueBeam中制作PDF仍然会将文件发送到MyDocuments,我必须从中复制它。您是否尝试将PDF995复制到PDF995X(例如)并将其修改为默认为横向(而PDF995保留默认的纵向)?我曾经使用过这种方法,因为打印机坚持使用存储的默认值而不是请求的默认值。