PrintPreviewControl is unable to show another document after printing failure
See original GitHub issue.NET version
8.0
Did it work in .NET Framework?
No
Did it work in any of the earlier releases of .NET Core or .NET 5+?
No
Issue description
Setting PrintPreviewControl.Document property value invokes generating preview of that document. If there was any exception during that process, PrintPreviewControl shows failure message:
In this case, after failing to generate preview, PrintPreviewControl is unable to show any other document.
Whatever value is set to PrintPreviewControl.Document property, PrintPreviewControl always shows failure.
In a video below:
- “Print successfully” button sets
PrintPreviewControl.Documentproperty to a document of 1 page; - “Print with error” button sets
PrintPreviewControl.Documentproperty to a document that fails to generate a preview; - “Reset” button sets
PrintPreviewControl.Documentproperty tonull.
https://github.com/dotnet/winforms/assets/113603457/ceafae8d-58be-403b-9e9a-d731c4435bd5
Note that after “Print with error” other buttons have no effect, PrintPreviewControl always shows error message.
Steps to reproduce
- Build and run SampleApp.zip
- Click “Print with error” button to show print failure.
- Click “Print successfully” button. PrintPreview is expected to show a document page, but it still shows print failure.
- Click “Reset” button. PrintPreview is expected to show “Document does not contain any pages.” message, but it still shows print failure.
Issue Analytics
- State:
- Created 2 months ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Document not visible on the Print Preview screen.
Print Preview screen is completely blank. However, I do have a document in normal view. ... Is the problem with printer settings or...
Read more >How to cancel PrintPreviewControl print when exception ...
My problem is that when user selects locked file through SaveFileDialog-like window PrintDocument.Print() throws Win32Exception.
Read more >How to fix Saved Word document not showing on Print ...
You will learn how to get rid of the “Saved Word document not showing on print preview” error from this article.
Read more >Printpreviewcontrol not showing document. No errors.
It is frustating because I had working before printing the datagridview from one tabpage, but when I tried to include another DGV from...
Read more >Print Preview throws unhandled exception, even when ...
This issue occurs when producing a print preview, while the other occurs when attempting to start normal printing. For this issue, the exception ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Filed a new issue https://github.com/dotnet/winforms/issues/9533 to track it.
@v-elnovikova Ok, thanks for your confirming.