question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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: print_failure

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.Document property to a document of 1 page;
  • “Print with error” button sets PrintPreviewControl.Document property to a document that fails to generate a preview;
  • “Reset” button sets PrintPreviewControl.Document property to null.

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

  1. Build and run SampleApp.zip
  2. Click “Print with error” button to show print failure.
  3. Click “Print successfully” button. PrintPreview is expected to show a document page, but it still shows print failure.
  4. Click “Reset” button. PrintPreview is expected to show “Document does not contain any pages.” message, but it still shows print failure.

Issue Analytics

  • State:closed
  • Created 2 months ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
MandiMancommented, Jul 21, 2023

@MandiMan - please open a new bug.

Filed a new issue https://github.com/dotnet/winforms/issues/9533 to track it.

0reactions
MelonWang1commented, Aug 1, 2023

@v-elnovikova Ok, thanks for your confirming.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found