tags:

views:

745

answers:

1

Hi all, first question on this site for me.

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 that 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 hte print method in the API which prints the active drawing to a specified printer.

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 for this??

I hope I've been clear enough, if not, I can add more information.

A: 

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.

Michael Baker