Printing fails and the existing file is deleted

Symptoms
Consider the following scenario:
  • You print out to a file by specifying an existing file to overwrite it.
  • Another application (e.g. Reader app) is opening the file as a memory-mapped file.
In this scenario, printing operation fails with the following error message:
Invalid handle.
Additonally, the specified existing file is deleted.
Cause
This problem may occur because of the behavior of StartDocPrinter API where an application calls to print out. The API tries to open the file exclusively first and if it fails then tries to delete it.
Resolution
Retry to print out when the problem occurs.
Workaround
To avoid this problem, specify a non-existent new file as an output file when printing.
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.
Properties

Article ID: 3181521 - Last Review: 08/25/2016 06:54:00 - Revision: 2.0

Windows 8, Windows 8.1, Windows 10

  • kbprint kbprinters KB3181521
Feedback