You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is about printing to file like print to pdf and the like.
My problem is that when user selects locked file through SaveFileDialog-like window PrintDocument.Print() throws Win32Exception. I catch it and present error dialog to the user. User accepts it and..... application hangs despite swallowing exception.
Is there a workaround for this issue? Tried putting Print() in BackgroundWorker so that i can kill it in catch clause but doesnt work since that access UI object in separate from UI thread. Tried making custom PrintController but achieving quality parity with previous code turned out to be very problematic.
Note: i dont mind using unsafe or reflection if thats what it takes to handle this specific scenario
Thanks in advance
EDIT: ah i forgot to mention that i use legacy WinForms on .NET Framework 4.8 if that affects available solutions.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
This is about printing to file like print to pdf and the like.
My problem is that when user selects locked file through
SaveFileDialog
-like windowPrintDocument.Print()
throwsWin32Exception
. I catch it and present error dialog to the user. User accepts it and..... application hangs despite swallowing exception.Is there a workaround for this issue? Tried putting
Print()
inBackgroundWorker
so that i can kill it in catch clause but doesnt work since that access UI object in separate from UI thread. Tried making customPrintController
but achieving quality parity with previous code turned out to be very problematic.Note: i dont mind using unsafe or reflection if thats what it takes to handle this specific scenario
Thanks in advance
EDIT: ah i forgot to mention that i use legacy WinForms on .NET Framework 4.8 if that affects available solutions.
Beta Was this translation helpful? Give feedback.
All reactions