Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Printing fails and the existing file is deleted


View products that this article applies to.

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.

↑ Back to the top


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.

↑ Back to the top


Resolution

Retry to print out when the problem occurs.

↑ Back to the top


Workaround

To avoid this problem, specify a non-existent new file as an output file when printing.

↑ Back to the top


Keywords: kbprint, kbprinters, kb

↑ Back to the top

Article Info
Article ID : 3181521
Revision : 1
Created on : 1/7/2017
Published on : 8/25/2016
Exists online : False
Views : 250