RodH257
RodH257

Reputation: 3632

Modifying a printers default settings from C#

Here's my situation:

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.

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.

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.

Can anyone point me in the right direction?

Upvotes: 3

Views: 5340

Answers (2)

KeachyPeenReturns
KeachyPeenReturns

Reputation: 71

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.

Upvotes: 0

Michael Baker
Michael Baker

Reputation: 3434

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.

Upvotes: 2

Related Questions