Failed to access print paramaters

Failed to access print paramaters

russ.green
Advocate Advocate
1,999 Views
5 Replies
Message 1 of 6

Failed to access print paramaters

russ.green
Advocate
Advocate

Any ideas why I might not be able to access print parameters?  This line of code is in my Execute method

 

Dim pMgr As PrintManager = commandData.Application.ActiveUIDocument.Document.PrintManager

 

failedtoaccessprintpanager.PNG

 

 

 

Russ Green
0 Likes
Accepted solutions (1)
2,000 Views
5 Replies
Replies (5)
Message 2 of 6

Aaron.Lu
Autodesk
Autodesk
Dear Russ, I could not reproduce your probolem.
this may happen when your Revit API objects are invalid, meaning lossing the pointer which points to native object of Revit,
to solve this, you should not use preserved objects e.g. fields in class which refer to Revit Document object, but rather, you'd better to re-obtain the object from Revit Application object.

Hope it helps.


Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 3 of 6

russ.green
Advocate
Advocate

 

My project will open and can be debugged from with VS 2012.  When I tried begbugging the project from within VS 2013 Community it throws a an exception at that line of code.

 

I'll try again later and take a closer look at your suggestion.

Russ Green
0 Likes
Message 4 of 6

Anonymous
Not applicable
Accepted solution

I once ran into an issue where if the Windows Print Spooler service was not started or was not working properly, trying to access the Document.PrintManager property would cause an exception to be thrown.

 

This appears to be the same exception that you are running into - it was of type Autodesk.Revit.Exceptions.InvalidOperationException with the text "Failed to access print parameters."

 

Take a look and make sure that the service is started and is running correctly.

 

PS: This exception isn't documented in the API docs. If someone from Autodesk sees this, could they create a wishlist item for it to be added?

Message 5 of 6

Aaron.Lu
Autodesk
Autodesk
Thanks for reporting this, I will log it.


Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 6 of 6

russ.green
Advocate
Advocate

I've rebooted my machine so can't know if this was the issue but its not happening today and print spooler is running so it could have been.

 

I'll keep an eye out for it.

 

Thanks

Russ Green
0 Likes