Cannot access the paper size and paper source of current printer

Cannot access the paper size and paper source of current printer

luis7SJJ3
Contributor Contributor
601 Views
1 Reply
Message 1 of 2

Cannot access the paper size and paper source of current printer

luis7SJJ3
Contributor
Contributor

I called External Event from Async Method with event.Rise() so now no exception related to Transaction. An exception raised which is related to PrintManager Access.

Below is the line of code on which i am getting exception. This code is inside Transaction 

 

PrintManager pMgr = doc.PrintManager;  

 

 

Exception on this line is 

Exception thrown: 'Autodesk.Revit.Proxy.Exceptions.InvalidOperationExceptionProxy' in RevitDBAPI.dll

Additional information: Cannot access the paper size and paper source of current printer

This code line is inside External Event, I tried to put that code line outside the external Event and inside Async method but same exception

 

I am pretty sure that this exception due to either Async or Externel Event but don't know how to come out of it. 

 

Any ideas?

 

@RPTHOMAS108 

0 Likes
602 Views
1 Reply
Reply (1)
Message 2 of 2

RPTHOMAS108
Mentor
Mentor

Would need more of an example.

 

Try without async is my initial advice.

 

To my mind the whole purpose of async was to call a function and continue without waiting for it to complete, some resources you probably can't avoid waiting for. There is an example of using async with ExternalEvents but it isn't a required ingredient for them.

 

I've not used async with external events. I used it recently outside of API but I had full control over both aspects of that i.e. the task I wasn't waiting for and the overall task that didn't need me to wait for that part of it. 

0 Likes