Printer cannot be used with main drawings print settings

Printer cannot be used with main drawings print settings

Anonymous
Not applicable
853 Views
5 Replies
Message 1 of 6

Printer cannot be used with main drawings print settings

Anonymous
Not applicable

I've been struggling with this issue for far too long, hope you can help.

When I'm trying to access Autodesk.Revit.DB.Document.PrintManager instance, I get "Microsoft XPS Document writer cannot be used with main drawings print settings" warning in Revit and my code stops executing until the user clicks OK button in the Revit dialog. My code is running on a remote server, so it's impossible for user to click the button.

 

How can I suppress the annoying warning?

 

Another thing, I've noticed, that whenever I open a model in Revit and open R -> Print -> Print Setup in the main menu, I get the same warning.

0 Likes
854 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

Hello skrotkih,

 

If the same thing happends regardless you use the API or manual print, then the problem probabily does not lie in the API. Have you tried to change your main printer or your settings? If you can't change in the Revit>Print, change in the Control Panel first.

 

Cheers

Ruben

 

0 Likes
Message 3 of 6

Anonymous
Not applicable

Hello Rubens1234

 

Thanks for your response!

I have tried setting the model printer to the default one and changing the system default printer to the one, used in a specific model. Both approaches work.

 

But I want it to work whatever printer is selected in the model.

 

I've also tried to change printer programmatically, when the model is opened, as follows:

 

var printManager = openDoc.PrintManager;
printManager.PrintSetup.CurrentPrintSetting = printManager.PrintSetup.InSession;

 

But the warning appears already, when the first line is hit.

0 Likes
Message 4 of 6

Anonymous
Not applicable

have you followed this link?

 

http://www.revitapidocs.com/2017/29599e18-cad8-813e-dc6e-04350fe37944.htm

 

"Once PrintManager is acquired from a document, changes of its global print setting properties are not automatically applied toward the global print setting. Should the local setting be used, the user needs to call the Apply method."

 

This might also help you: http://adndevblog.typepad.com/aec/2012/05/printmanagerprintrange-cannot-be-changed-to-printrangesele...

0 Likes
Message 5 of 6

Anonymous
Not applicable

I've checked out the both links, they are referring to acquire PrintManager from the current document. This operation brings immediately the warning dialog and the code will await the users response.

 

How can I use global settings without accessing openDoc.PrintManager? Because this operation causes the stop.

0 Likes
Message 6 of 6

Anonymous
Not applicable

I don't know how to help you further mate. 

 

By the way, why store the print manager in a 'var' while you know it is a 'PrintManager' type?

 

0 Likes