title: PrintDocument.Print results in Win32Exception The operation completed successfully
body: <p>I am trying to print in a C# .NET 3.5 app to a network printer and getting this exception: </p>
  
  <blockquote>
    <p>The operation completed successfully</p>
  </blockquote>
  
  <p>What is causing it, and how can it be solved?</p>
  
  <pre><code>System.ComponentModel.Win32Exception: The operation completed successfully
     at System.Drawing.Printing.PrinterSettings.GetHdevmodeInternal()
     at System.Drawing.Printing.PrinterSettings.GetHdevmode(PageSettings pageSettings)
     at System.Drawing.Printing.PrintController.OnStartPrint(PrintDocument document, PrintEventArgs e)
     at System.Windows.Forms.PrintControllerWithStatusDialog.OnStartPrint(PrintDocument document, PrintEventArgs e)
     at System.Drawing.Printing.PrintController.Print(PrintDocument document)
     at System.Drawing.Printing.PrintDocument.Print()
  </code></pre>
  
  <ul>
  <li>the account has permissions to print using the network printer. The permissions are set for Everyone to print.</li>
  <li>the printer has been deleted and recreated.</li>
  <li>the setting for spooling vs printing directly to the printer has been toggled both ways.</li>
  <li>other printers on the machine work fine</li>
  <li>other clients on the network and apps on this same machine can print to this printer without issue.</li>
  </ul>
  
  <p>To narrow the issue down, I've created a simple console app. Running as a normal user, the app prints. When Run As the service account, it errs <strong>for the service account</strong>.</p>
  
  <p><img src="https://i.stack.imgur.com/9mYLs.png" alt="enter image description here"></p>
  
  <p>The <strong>resolution</strong> to my problem was to uninstall the driver that is causing the issue, and install an older driver.</p>